SQL: distinct on single field

Heinrich Ruoff heinrichruoff at gmail.com
Wed Mar 22 11:45:07 CST 2006


Hi to all,

is it possible to use DISTINCT only on a single field instead of all
selected fields?

e.g.:

id ProductCode Color
1 product_a red
2 product_a blue
3 product_b green

SELECT DISTINCT ProductCode, Color, id FROM Products

-> all records are returned because id and color are different

but I'd like to make only ProductCode DISTINCT to get only the first
apperance of  product_a

thx
Heinrich


More information about the Valentina mailing list