Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Weird Select statement

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-12-18 : 08:23:40
I am trying to create a select statement that looks a column which contains numerical entries and then pulls 5 rows which have the heist numbers, and then it outputs the results in a random order. Anyone know how to do this?

Thanks.

--
For thouse with wings, fly to your dreams.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-18 : 08:34:08
SELECT A.* FROM (SELECT TOP 5 * FROM myTable ORDER BY numCol DESC) A
ORDER BY NEWID()

Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2002-12-18 : 09:43:56
Thanks! That worked perfictly.

--
For thouse with wings, fly to your dreams.
Go to Top of Page
   

- Advertisement -