Home Forums SQL Server 2005 T-SQL (SS2K5) Randomly Select Record From Join Result RE: Randomly Select Record From Join Result
ChiragNS
One Orange Chip
Points: 26137
More actions
October 14, 2009 at 11:49 pm
#1066095
SELECT TOP 1 AccountID, NewAccountId from #a
ORDER BY CASE WHEN CAST((RAND() * 10) AS INT)%2 = 0 THEN AccountID ELSE NewAccountId END ASC
Using newid() method is more "random" though.
"Keep Trying"