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!

Get total COUNT(*) and other columns in one SELECT

446249Sep 21 2006 — edited Sep 21 2006
Hi. I need to return the Count(*) along with a few other columns, but have had no luck creating the correct PL/SQL statement. Here's the statement I've got,

select page_id, role_id, count(*) as cnt
from user u
where trim(u.email_id) = trim('myemailID')
and u.is_active = 'Y'
group by u.page_id, u.role_id;

This returns this data,

page_id role_id cnt
--------------------------------------------------
ADMIN SA 1
COMPOSE SA 1
ANNOUNCE SA 1

I'd like to get the value 3 in this case for the column cnt. How do I do this? Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2006
Added on Sep 21 2006
7 comments
865 views