|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
max querie help
hi, i had 2 make a database for an assignment and write up queries to retirve data from iti am having some problems with the queries
here is my querie SELECT C.ClientName, co.clientid, Count(*) as Total_Orders From Client C ,ClientOrder CO WHERE C.ClientID = CO.ClientID group by c.clientname, co.clientid ORDER BY COUNT(c.clientname) DESC; and here is the result of it CLIENTNAME CLIENTID TOTAL_ORDERS ------------------------------ ---------- ------------ John SMith 1 5 Tree corp 7 4 ford 3 2 maccas 2 2 Simpsons 4 2 stardust 5 1 nuclear plant 6 1 i need to display only the maximum and not all of them , all i need is the first one 2 show, or if you know how i can improve the querie please let me know |
|
#2
|
|||
|
|||
|
Code:
SELECT top 1 C.ClientName, co.clientid, Count(*) as Total_Orders From Client C ,ClientOrder CO WHERE C.ClientID = CO.ClientID group by c.clientname, co.clientid ORDER BY COUNT(c.clientname) DESC |
|
#3
|
|||
|
|||
|
thanx for the rpely but im getting this error
ERROR at line 1: ORA-00923: FROM keyword not found where expected its pointing at 1 |
|
#4
|
|||
|
|||
|
Why are you posting queries relating to Oracle in a forum dedicated to Microsoft SQL server?
|
|
#5
|
|||
|
|||
|
This seems to be the Oracle Forum...
![]() Pabloj: I moved the thread to the right forum. Last edited by pabloj : May 12th, 2005 at 09:16 AM. |
| Viewing: Dev Shed Forums > Databases > Oracle Development > max querie help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|