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

select rand column

Status
Not open for further replies.

zebrak459

Programmer
Aug 18, 2007
1
SK
SELECT VirtualNicks.Nick,(SELECT TOP (1) VirtualMessages
FROM VirtualMessages ORDER BY NEWID()) AS ENick
FROM VirtualNicks
INNER JOIN OnlineOfflineUsers ON VirtualNicks.Nick = OnlineOfflineUsers.Nick
WHERE (OnlineOfflineUsers.OnlineUser = '1')


help me
mate u mna pifko...


VirtualNicks.Nick
VN1
VN2
VN3
VN4
VN5
VirtualMessages.VirtualMessages
VM1
VM2
VM3
VM4
VM5
OnlineOfflineUsers.OnlineUser
1
1
1
1
1
result ..... not working as i want(ORDER BY NEWID())
VN1 VM1
VN2 VM1
VN3 VM1
VN4 VM1
VN5 VM1
I need to get rand rows on right column
VN1 VM3
VN2 VM1
VN3 VM2
VN4 VM2
VN5 VM5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top