Re: Random sort with distinct

From: "Ozer, Pam" <pozer(at)automotive(dot)com>
To: "Dmitriy Igrishin" <dmitigr(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Random sort with distinct
Date: 2010-10-04 15:40:43
Message-ID: 216FFB77CBFAEE4B8EE4DF0A939FF1D10182D0@mail-001.corp.automotive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

What about dynamic queries?

From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Dmitriy Igrishin
Sent: Saturday, October 02, 2010 6:40 AM
To: Ozer, Pam
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Random sort with distinct

Hey Ozer,

How about dynamic queries?

2010/10/2 Ozer, Pam <pozer(at)automotive(dot)com>

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 select.

Thanks

Pam

--
// Dmitriy.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Forø Tollefsen 2010-10-06 11:11:04 Create Datefield from 3 fields
Previous Message Joshua Tolley 2010-10-04 13:24:39 Re: join returns too many results...