Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: sql query


Message #1 by "brandon" <nodnarb_33@y...> on Mon, 17 Sep 2001 15:49:43
I'm interesting in SQL very much. I just  wonder if we
need the "GROUP BY flight " for this target?    

Could anybody give me the difference about speed
between 
1. SELECT flight, min(cost) 
FROM Table 
WHERE location1 = 'paris'
AND location2 = 'london'

and 

SELECT top 1 flight, cost
FROM Table 
WHERE location1 = 'paris'
AND location2 = 'london'
ORDER by cost

Thank You and Regards
nnan.

---------------------------------------
If london and paris are text, add in quotes. If this
is a generated SQL
statement you would get errors if there were city
names with spaces eg Wagga
Wagga, Port Arthur etc.

SELECT flight, min(cost) 
FROM Table 
WHERE location1 = 'paris'
AND location2 = 'london'
GROUP BY flight

regards
David Cameron
nOw.b2b
dcameron@i...

-----Original Message-----
From: Alastair Ramsay [mailto:aramsay@h...]
Sent: Tuesday, 18 September 2001 12:55 AM
To: sql language
Subject: [sql_language] RE: sql query


Select flight, min(cost) 
from Table 
where location1=paris 
AND location2=london
group by flight

Alastair

  Return to Index