like
select ho from (select sourceaddress,count(sourceaddress) as
src,hour(eventtime) as ho
from default.fullandfinal
where sourceaddress='0.0.0.0' and eventtime between '2019-05-11 00:00:00' and
'2019-05-11 19:59:59'
group by sourceaddress,hour(eventtime) order by sourceaddress,ho) t where
src=28350;
the output of this query is 11 and i want to use this output in my nxt query which is
select sourceaddress,destinationaddress,destinationport,name,count(*) as count
from fullandfinal
where eventtime like "11%" and sourceaddress='0.0.0.0'
group by sourceaddress,destinationaddress,destinationport,name
order by count desc limit 5;
i want to write single query for this is it possible ?
Considering MySQL - Yes possible. You have to use the first query as Sub Query in the second Query. The query structure will be something like this-
For both above case, you have to make sure your sub query returns one single value that is like 11 you mentioned.
Try This-