i have a column full of resort id's say 44 rows, i am using the following query
Query-> SELECT DISTINCT RESORT ID FROM Schema.table Name WHERE Condition='Value' AND ROW NUMBER= 1
the above query returns one value say='15'
when i run it multiple it is returning the same value =
'15'
!!!i require a different value each time the query is ran
could any one please help me out.
Thanks,
Asked
Active
Viewed 91 times
-1

Jesuraja
- 3,774
- 4
- 24
- 48
-
2What is condition value and row number? field of the table? Can you show your query? – Jesuraja Jun 26 '14 at 10:03
-
1Dublicate? http://stackoverflow.com/questions/848872/select-n-random-rows-from-sql-server-table – BaBL86 Jun 26 '14 at 10:05
1 Answers
0
You will get Random Resort ID by using this
SELECT TOP 1 ResortID FROM TableName
-- WHERE <Condition>
ORDER BY NEWID() ASC

Jesuraja
- 3,774
- 4
- 24
- 48
-
Thanks jusuraja could you please tell me how to make this query work in DBvisualizer! – user3778746 Jun 26 '14 at 13:50