Home > Software design >  Return random value for each row from different table
Return random value for each row from different table

Time:02-12

I'm trying to get random name for each row, but it just shows same random value for every row. What am I missing?

SELECT TOP (1000)  v.id,v.[Name], RandomName 
FROM [V3_Priva].[dbo].[Vehicle] v
cross join
(Select top 1 ISNULL([Description_cs-CZ], [Description]) RandomName
from crm.Enumeration e
join crm.EnumerationType et on e.EnumerationType_FK = et.Id
where  EnumerationType_FK = 12
order by NEWID()) RandomName

enter image description here

  • Related