Need help in sql query [message #422831] |
Sun, 20 September 2009 03:42  |
vparunaix
Messages: 3 Registered: August 2009 Location: India
|
Junior Member |
|
|
Hi Everyone ,
i m a new bee to sql.
I have a below query which returns like this
select count(*),cc,fai from cindata GROUP BY cc,fai;
COUNT(*) CC FAI
---------- -- ----------
3 ab 2
1 ac 6
3 ab 1
I want the sum of count values returned on ROW 1 from this query.
any one help me ?
|
|
|
|
|
Re: Need help in sql query [message #422835 is a reply to message #422834] |
Sun, 20 September 2009 04:29   |
_jum
Messages: 577 Registered: February 2008
|
Senior Member |
|
|
Use a subquery:
SELECT SUM(cnt) FROM
(
SELECT COUNT(*) cnt, cc, fai FROM cindata
GROUP BY cc, fai
)
But You will only get the same result as:
SELECT COUNT(*) FROM cindata
|
|
|
Re: Need help in sql query [message #422837 is a reply to message #422831] |
Sun, 20 September 2009 05:42  |
 |
Michel Cadot
Messages: 68733 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version with 4 decimals.
Post a working Test case: create table and insert statements along with the result you want with these data.
Regards
Michel
|
|
|