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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get two random records of each state in a table

Status
Not open for further replies.

Swi

Programmer
Joined
Feb 4, 2002
Messages
1,978
Location
US
Can someone point me in the right direction on how to select two of each state within a table but pull them randomly? Thanks.

Swi
 
States within the United States:

PA
DE
FL
GA
DC
etc...

Swi
 
If you want an answer you have to put some effort into writing a question. I can think about 10 ways to do this but I got no idea what the output is.

Is it a list of 100 items ( 2 of each state) in a random order? You could simply "Select RND(ID) as SortOrder, strState from tblStates as A UNION ALL Select Rnd(ID) as SortOrder, strState from tblStates as B;"

Are you doing a recordset draw in code and feeding a variable?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top