Re: [SQL] Random sort with distinct

2010-10-04 Thread Ozer, Pam
What about dynamic queries? From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Dmitriy Igrishin Sent: Saturday, October 02, 2010 6:40 AM To: Ozer, Pam Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Random sort with distinct Hey Ozer, How about

Re: [SQL] Random sort with distinct

2010-10-02 Thread Tom Lane
"Ozer, Pam" writes: > Select Distinct VehicleMake, VehicleModel > From VehicleYearMakeModelTrim > Order by random() > Limit 10; > I don't want to bring back the random number I just want the sort order > to be random. How can I sort randomly? This query breaks because > random() is not in the se

Re: [SQL] Random sort with distinct

2010-10-02 Thread Lee Hachadoorian
This runs fine on my 8.4 install. What version are you using and what error message are you getting? --Lee On 10/01/2010 04:51 PM, Ozer, Pam wrote: I have the following query   Select Distinct VehicleMake, VehicleModel From VehicleYearMakeModelTrim Order by random()

Re: [SQL] Random sort with distinct

2010-10-02 Thread Dmitriy Igrishin
Hey Ozer, How about dynamic queries? 2010/10/2 Ozer, Pam > I have the following query > > > > Select Distinct VehicleMake, VehicleModel > > From VehicleYearMakeModelTrim > > Order by random() > > Limit 10; > > > > I don’t want to bring back the random number I just want the sort order to > be

[SQL] Random sort with distinct

2010-10-02 Thread Ozer, Pam
I have the following query Select Distinct VehicleMake, VehicleModel >From VehicleYearMakeModelTrim Order by random() Limit 10; I don't want to bring back the random number I just want the sort order to be random. How can I sort randomly? This query breaks because random() is not in the