in reply to Re: Help with manipulating data from a database??
in thread Help with manipulating data from a database??
The basic rule is that you can include as many fields in a summary query as you like, provided that each one of them has either a summary operation (such as min()) or a GROUP BY applied to it. (This does rule out anything like SELECT * without going to a subquery, but, then, I only use SELECT * when I'm querying by hand anyhow. Using it in my code carries too much risk of breakage if the table's columns get reordered.)SELECT stop_reference, service_id, min(distance) FROM table GROUP BY stop_reference, service_id ;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Help with manipulating data from a database??
by ForgotPasswordAgain (Vicar) on Jul 03, 2007 at 08:36 UTC |