MySQL Forums
Forum List  »  General

Re: selecting distinct records with group max value
Posted by: Peter Brawley
Date: May 17, 2006 04:22PM

I agree it breaks the rules, but we just created the tmp table from a determined order, and we inserted no additional rows into it, so I'd be surprised if ORDER BY were needed selecting from it.

I think you are right, the CREATE ... ORDER BY should be fld1 ASC, val DESCc, fld2 ASC, fld3 ASC.

Your WHERE clause version might get munged by WHERE clause optimisation.

It's the first query that's slow, right? Did you run EXPLAIN on it?

PB

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.