Home » SQL & PL/SQL » SQL & PL/SQL » Need help on to get the number of records (not a simple count()) (Oracle9i)
Need help on to get the number of records (not a simple count()) [message #445952] Thu, 04 March 2010 20:55 Go to next message
azzarossi
Messages: 1
Registered: March 2010
Location: KL
Junior Member
Hi,

I'm a new user of Oracle but I'm quite used of using the sql statement in SQL server. I noticed some of the sql syntax are different. I have a question here that need help from oracle experts out there. My sql statement is as below;

---Select fieldA, Sum(fieldB+fieldC) as fieldD, fieldE, fieldF from TableA group by fieldA, fieldE, fieldF ---

the output will be as below;

fieldA fieldD fieldE fieldF
------ ------------- ------ ------
fieldA fieldB+fieldC fieldE fieldF

However, I need to have the total of no of records displayed for the sql statement and I need it in one sql statement with the one above so that I can display the total no of records along with the information for each field. Anyone can help on this?

Thanks a lot. Looking forward for your answer.
Re: Need help on to get the number of records (not a simple count()) [message #445953 is a reply to message #445952] Thu, 04 March 2010 21:07 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>However, I need to have the total of no of records displayed for the sql statement and I need it in one sql statement with the one above so that I can display the total no of records along with the information for each field. Anyone can help on this?

I see what you wrote, but am not clear on exactly what you desire.

> I need to have the total of no of records displayed for the sql statement

Displayed exactly where?
Displayed on each row?
Displayed after all rows returned?


It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/
It would be helpful if you provided DDL (CREATE TABLE ...) for tables involved.
It would be helpful if you provided DML (INSERT INTO ...) for test data.
It would be helpful if you provided expected/desired results & a detailed explanation how & why the test data gets transformed or organized.
Re: Need help on to get the number of records (not a simple count()) [message #445957 is a reply to message #445952] Thu, 04 March 2010 21:52 Go to previous message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
As your requirment is not so much clear, we can't reply with perfect answer.
According to me, you are searching for aggrigate COUNT().

regards,
Delna
Previous Topic: RETURN statement (merged by CM)
Next Topic: i have a query to solve
Goto Forum:
  


Current Time: Fri Dec 09 08:11:09 CST 2016

Total time taken to generate the page: 0.18803 seconds