Home » SQL & PL/SQL » SQL & PL/SQL » how to write a query (oracle 9i)
how to write a query [message #319831] Tue, 13 May 2008 02:35 Go to next message
sharathmpatil
Messages: 38
Registered: February 2008
Location: Bangalore
Member

Hi,
i have a table called projects.

id name department
100 p1 d1
101 p1 d1
102 p1 d1
103 p2 d2
104 p2 d2
105 p3 d3.

the out put requred is like this
p1 3(how many times p1 d1 repeated)
how to write the query for this.
please help.

thanks in advance
Re: how to write a query [message #319834 is a reply to message #319831] Tue, 13 May 2008 02:43 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
It's good that you have posted what you want. But what you have not done is what you have tried so far to achieve what you want. So to start with read the oracle sql reference manual. and the link is

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm
Search for functions like

a) Count
b) Group by Clause

Happy Learning Sql.

Regards

Raj
Re: how to write a query [message #319835 is a reply to message #319831] Tue, 13 May 2008 02:44 Go to previous messageGo to next message
Littlefoot
Messages: 20895
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Sounds like COUNT and GROUP BY question.

[EDIT] Looks like I was right.

Also, two wrongs don’t make a right, but two Wrights made an airplane.

[Updated on: Tue, 13 May 2008 02:46]

Report message to a moderator

Re: how to write a query [message #319842 is a reply to message #319835] Tue, 13 May 2008 03:12 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
> Also, two wrongs don’t make a right, but two Wrights made an airplane.

Good one Smile

Regards

Raj
Re: how to write a query [message #319845 is a reply to message #319831] Tue, 13 May 2008 03:29 Go to previous messageGo to next message
shanthakumar.utt
Messages: 15
Registered: May 2008
Location: bangalore
Junior Member
can u tell me what exact u want in query
Re: how to write a query [message #319848 is a reply to message #319845] Tue, 13 May 2008 03:48 Go to previous message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
"u" is not member of this forum.
OP clearly said what he wants and question has been answered.

Regards
Michel
Previous Topic: Bitmap index
Next Topic: execution
Goto Forum:
  


Current Time: Mon Dec 05 20:58:49 CST 2016

Total time taken to generate the page: 0.20034 seconds