Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select and random number

Status
Not open for further replies.

bisanthe

Technical User
Nov 11, 2005
4
0
0
TR
hi, (newbie)
hi i have generated a random number
lower = 1
upper = select count(*) from table where criteria
random = Round(((@Upper - @Lower -1) * Rand() + @Lower), 0)

let say random = 8
and upper = 18.
how can i get 8. result in
select * from table where criteria --statement.
 
i found a solution i hope this help other guys
(mssql)
select top 1 * from table where criteria order by newid()
i am not sure but mysql is using limit instead of top.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top