SQL: distinct on single field
Heinrich Ruoff
heinrichruoff at gmail.com
Wed Mar 22 22:02:31 CST 2006
Hi Igor,
doesn't seem to work in my application.
When I test the simple example in Valentina Studio
I get the error:
"In the SELECT clause you can use only fields listed in the GROUP BY and
aggregative functions."
grz
Heinrich
On 3/22/06, Ivan Smahin <ivan_smahin at valentina-db.com> wrote:
>
> Hello Heinrich,
>
> Wednesday, March 22, 2006, 1:45:07 AM, you wrote:
>
> > 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
>
>
> SELECT ProductCode, Color, id FROM Products Group By ProductCode
>
>
>
> --
> Best regards,
> Ivan mailto:ivan_smahin at valentina-db.com
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
More information about the Valentina
mailing list