Re: ORDER BY "RANDOM"

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 06/17/04


Date: Thu, 17 Jun 2004 22:15:48 +0530

use "order by newid()"

ex:
use northwind
go
select * from customers
order by newid()
go

-- 
Vishal Parkar
vgparkar@yahoo.co.in | vgparkar@hotmail.com
"Rafael Chemtob" <rchemtobb@nospam.yahoo.com> wrote in message
news:uK8sSoIVEHA.1652@TK2MSFTNGP09.phx.gbl...
> hi,
> I want to query a table but I want the resultset in a random order that's
> decided by the SQL server.
> How would I write the ORDER BY clause.
>
> thanks
> rafael
>
>
>


Relevant Pages

  • Re: Sort Using A View
    ... select top 100 percent * from customers ... Rather use order by clause in the final query. ... Vishal Parkar ...
    (microsoft.public.sqlserver.programming)
  • Re: IIF in where clause to exclude selection criteri when null
    ... if i understand you correctly you are looking for query as follows, ... then no condition for acctnum will be checked otherwise acctnum will be ... -- and same query will retrieve releted rows from table customers ... Vishal Parkar ...
    (microsoft.public.sqlserver.mseq)
  • Re: Random sort via SQL in ASP
    ... Sort your data by NewID for use in your ASP. ... run the update query again. ...
    (comp.databases.ms-access)
  • Re: help...Cant delete from specified tables
    ... Step 1 is to get a list containing NewID for AdadmasterUpdated that shows ... Save this query, when you open this query you should only be able to see ... I've tried using the totals query as it is, as well as using a table ... FROM ACADMASTERUPDATED INNER JOIN totalACADMASTERUPDATEDtbl ON ...
    (microsoft.public.access.queries)
  • Distinct records and NEWID()
    ... Using SQL 7 and classic ASP - ... Here's my query: ... featuredselection f, view_vendor_default v WITHWHERE ... NEWID(), because NEWIDwould have to be in the SELECT list, and ...
    (microsoft.public.inetserver.asp.db)