Home » SQL & PL/SQL » SQL & PL/SQL » SQL (Oracle 10g)
SQL [message #621467] Wed, 13 August 2014 10:12 Go to next message
gopikannan
Messages: 2
Registered: August 2014
Location: chennai
Junior Member
I have a table of result like this.
SLNO LOC  CODE
1    A    100
2    B    115
3    C    125
4    D    145     

HOW I CAN GET A OUTPUT LIKE BELOW..(I WANT THE TOTAL NUMBER OF ROWS AS LAST COLUMN)
SLNO LOC  CODE   COUNT
1    A    100    4
2    B    115    4 
3    C    125    4
4    D    145    4


*BlackSwan added {code} tags. Please do so yourself in the future. http://www.orafaq.com/forum/t/174502/

[Updated on: Wed, 13 August 2014 10:21] by Moderator

Report message to a moderator

Re: SQL [message #621468 is a reply to message #621467] Wed, 13 August 2014 10:13 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
welcome to this forum.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/

Re: SQL [message #621469 is a reply to message #621467] Wed, 13 August 2014 10:16 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum. Please read our OraFAQ Forum Guide and please read How to use [code] tags and make your code easier to read

One solution is to write a query that projects the three columns, and projects a fourth column which is a subquery that counts the rows in the table.

Is this a college homework question?
Re: SQL [message #621470 is a reply to message #621469] Wed, 13 August 2014 10:20 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Another option would be an Analytic Count
Re: SQL [message #621471 is a reply to message #621470] Wed, 13 August 2014 10:25 Go to previous message
gopikannan
Messages: 2
Registered: August 2014
Location: chennai
Junior Member
its Works. Thanks to Thomas.
Previous Topic: parent and Child issue ?
Next Topic: USE IS NULL AND NOT NULL IN A CHECK CONSTRAINT
Goto Forum:
  


Current Time: Thu Apr 25 06:14:32 CDT 2024