[thelist] SQL to return one result for duplicate values

Erik Mattheis gozz at gozz.com
Mon Apr 29 20:32:01 CDT 2002


Yes, perfect (and a lot simpler than everything else I tried that
didn't work!). Thanks much!

At 11:02 AM +1000 4/30/02, Paul Cowan wrote:
>  > I would like to query this table and come up with the
>>  following result:
>>
>>  word_id  word_value
>>  1        butter
>>  2        guns
>>  5        gas
>
>SELECT
>	word_value, min(word_id) as first_word_id
>FROM
>	table_name
>GROUP BY
>	word_value
>
>How's that? You don't have to use min(), you can use max(), or some DBMSes
>have first(), or whatever.

--

__________________________________________
- Erik Mattheis

(612) 377 2272
http://goZz.com/

__________________________________________



More information about the thelist mailing list