Hi, i was looking for some help in regards to understanding the general rule of using the count function. I am trying to build my knowledge of the different functions in order for me to have a better understanding so that I am writing my sql queries in the right way.
What i was looking to find out was trying to understand the count function. As i understand I can apply the following in order to give me a count of a particular set of data.
select number, count(*) AS no_count
from test
group by job_id;
What I am trying to understand is if for some reason I wanted to use the results of the "count(*) AS no_count" to give me another set of results i.e. sum all values over 2 for example, would i write it like the following:
select number, count(*) AS no_count,
select count(no_count) having etc...
from test
group by job_id;
or is the general rule that I would have to write a select within a select?
If somebody could please help, would really appreciate it. Btw if there is any documentation on using count, as well as using this with other functions i.e. sum than that would be very useful as well.
Thanks in advance.