List:General Discussion« Previous MessageNext Message »
From:Dotan Cohen Date:October 20 2011 10:01pm
Subject:Re: How to select the id of 2+ records for given user?
View as plain text  
2011/10/20 Halász Sándor <hsv@stripped>:
> Well done--but....
>
> Although, it seems, it is everyone s experience that the desired order is the order
> that MySQL yields, all guarantee of that is explicitly deny'd (look up 'GROUP BY'). It is
> better to be safe and to use "MIN":
>
> select * from table1 where messageID NOT IN (
> select MIN(messageID) from table1
> group by userID
> )
>
>

Thanks. I actually used ORDER BY and LIMIT, I should have used MIN.
This is how one learns!

Thank you!


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
Thread
How to select the id of 2+ records for given user?Dotan Cohen19 Oct
  • Re: How to select the id of 2+ records for given user?Michael Dykman19 Oct
    • Re: How to select the id of 2+ records for given user?Derek Downey19 Oct
      • Re: How to select the id of 2+ records for given user?Basil Daoust20 Oct
        • Re: How to select the id of 2+ records for given user?Derek Downey20 Oct
          • Re: How to select the id of 2+ records for given user?Dotan Cohen20 Oct
        • Re: How to select the id of 2+ records for given user?Dotan Cohen20 Oct
        • Re: How to select the id of 2+ records for given user?hsv20 Oct
          • Re: How to select the id of 2+ records for given user?Dotan Cohen21 Oct