Thread: distinct+trim=error?

distinct+trim=error?

From
Boszormenyi Laszlo
Date:
Hello!

 First, thanks for everybody who helped me with my previous problem.
Now I have an other, and I can not figure out why this happens.
Any idea?

=> select distinct trim(city) from lodge order by city;
ERROR:  For SELECT DISTINCT, ORDER BY expressions must appear in target list

Cheers,
    Laszlo


RE: distinct+trim=error?

From
"Tamsin"
Date:
Probably (can't try this at the moment as I'm at home) you need to do:

 select distinct trim(city) from lodge order by trim(city);

Hope this helps
Tamsin

> -----Original Message-----
> From: pgsql-novice-owner@hub.org [mailto:pgsql-novice-owner@hub.org]On
> Behalf Of Boszormenyi Laszlo
> Sent: 24 September 2000 14:43
> To: pgsql-novice@hub.org
> Subject: [NOVICE] distinct+trim=error?
>
>
> Hello!
>
>  First, thanks for everybody who helped me with my previous problem.
> Now I have an other, and I can not figure out why this happens.
> Any idea?
>
> => select distinct trim(city) from lodge order by city;
> ERROR:  For SELECT DISTINCT, ORDER BY expressions must appear in
> target list
>
> Cheers,
>     Laszlo
>
>