SELECT     *
FROM         yourTable
ORDER BY NEWID()

Should you want 1 or X records returned use

SELECT     TOP 1 *
FROM         yourTable
ORDER BY NEWID()

Taco Fleur

----- Original Message -----
From: "Bryan Nolen" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, February 10, 2003 6:48 PM
Subject: [cfaussie] Re: Random Record in a query


> Hmm, should work under PostGreSql, any MSSQL experts wanna convert it?
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Phil
> Rasmussen
> Sent: Monday, 10 February 2003 7:46 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: Random Record in a query
>
>
> Bryan I get a Syntax error when using that ORDER BY clause in MSSQL....and
> ideas?
>
> Phil
>
>
> "Bryan Nolen" <[EMAIL PROTECTED]> wrote in message news:22852@cfaussie...
> >
> > Just add
> > ORDER BY RANDOM LIMIT 1
> > To the query will return one random record from the criteria
> >
> > In MSSQL change LIMIT with TOP
> >
> > Bryan Nolen
> > Lead Developer
> > http://Arc.Net.AU
> > http://cdonline.com.au
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]] On Behalf Of Dean
> > Brandt
> > Sent: Monday, 10 February 2003 7:16 PM
> > To: CFAussie Mailing List
> > Subject: [cfaussie] Random Record in a query
> >
> >
> >
> > Hi Guys,
> >
> > I am retrieving a set of records using a query and I want to
> > pick a random record from that query and display it, any pointers on how
> > this is achieved?
> >
> > Thanks
> >
> >
> > Dean Brandt
> > Clever Thinking Consulting
> > Network/Systems Integration,
> > Application Design
> > Melbourne, Australia
> > 0418488885
> > ...smart networks for smart business
> >
> >
> > ---
> > You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> > [EMAIL PROTECTED]
> >
> > MX Downunder AsiaPac DevCon - http://mxdu.com/
> >
> >
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.449 / Virus Database: 251 - Release Date: 28/01/2003
>
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/
>


----------------------------------------------------------------------------
----


> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/
>



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to