MySQL Forums
Forum List  »  General

Re: selecting distinct records with group max value
Posted by: Peter Brawley
Date: May 18, 2006 07:15AM

I do not know why putting the IF(...) clause in the WHERE clause gives different results.

By the first query needing an EXPLAIN I mean

SELECT
fld1, fld2, fld3, val
WHERE IF( fld1 = @prev, 0, @prev := fld1 ) > 0
FROM tbl
ORDER BY ...

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.