Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Count Over Count

976439Dec 17 2012 — edited Dec 17 2012
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.
This post has been answered by Frank Kulash on Dec 17 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 14 2013
Added on Dec 17 2012
11 comments
2,071 views