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 one Record at random from a Select Query 1

Status
Not open for further replies.

XP2000

Programmer
Dec 14, 2001
40
0
0
GB
I'm struggling to pull one record at random when using a select query with a WHERE clause.

Table = TblPlayers has 2 relevant fields: NAME & SEASON.
I need to select just one RANDOM record WHERE the season="2004-05".

I'm sure this is an elementary question, but I just can't figure it out.
 
Has TblPlayers an unique numeric field ?
If yes, say myID, you may try something like this:
SELECT TOP 1 Rnd(myID), ...
FROM TblPlayers
WHERE season='2004-05'
ORDER BY 1;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top