Re: Random sort with distinct

From: Lee Hachadoorian <lee(dot)hachadoorian(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Random sort with distinct
Date: 2010-10-02 13:42:29
Message-ID: 4CA736C5.5080606@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
This runs fine on my 8.4 install. What version are you using and what
error message are you getting?<br>
<br>
--Lee<br>
<br>
On 10/01/2010 04:51 PM, Ozer, Pam wrote:
<blockquote
cite="mid:216FFB77CBFAEE4B8EE4DF0A939FF1D10182C8(at)mail-001(dot)corp(dot)automotive(dot)com"
type="cite">
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I have the following query<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Select Distinct VehicleMake, VehicleModel<o:p></o:p></p>
<p class="MsoNormal">From VehicleYearMakeModelTrim<o:p></o:p></p>
<p class="MsoNormal">Order by random()<o:p></o:p></p>
<p class="MsoNormal">Limit 10;<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I don&#8217;t want to bring back the random number I
just
want the sort order to be random. How can I sort randomly?&nbsp; This query
breaks
because random() is not in the select.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Pam<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size: 12pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;;"><br>
<br>
</span><o:p></o:p></p>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Lee Hachadoorian
PhD Student, Geography
Program in Earth &amp; Environmental Sciences
CUNY Graduate Center
</pre>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 3.1 KB

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2010-10-02 13:52:50 Re: Random sort with distinct
Previous Message Dmitriy Igrishin 2010-10-02 13:40:15 Re: Random sort with distinct