[thelist] SQL to return one result for duplicate values

rudy r937 at interlog.com
Mon Apr 29 21:59:01 CDT 2002


>>    select word_id, word_value, word_type, word_date
>>      from thetable XX
>>    where word_id =
>>          ( select min(word_id)
>>                from thetable
>>             where word_value = XX.word_value )
>
> Yes, something like that was the solution (I think you meant where
> word_id IN instead of where word_id =).

no, not IN, because select min(word_id) returns only one value

basically, the above says "gimme the row where the word_id is the lowest
word_id of all the rows that have the same word_value as this one"

easy -- if you get the english right first, that is...


rudy




More information about the thelist mailing list