On 27-Feb-2003 Sheryl Canter wrote:
<snip>
>
> SELECT *
> FROM programs p, authors a, royalties r
> WHERE p.ProgramID = r.ProgramID AND a.AuthorID = r.AuthorID
>
> I could change this to SELECT DISTINCT * ..., but then which author would I
> get? If it's always the first encountered row, then could I avoid checking
> the royalty by always inserting the authors into the table in the correct
> order? (I know this is sloppy.) What is the rule used by SELECT DISTINCT
> to choose which row to return?
>
> If I wanted to do it right and select the author receiving the maximum
> royalty, how would I adjust the SELECT statement?
>
You'll probably need an 'ORDER BY' somewhere in there.
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php