Skip to main content
Post Closed as "Not suitable for this site" by EazyE, identigral, glls, Mohith Shrivastava, Oleh Berehovskyi
edited tags
Link
Source Link

Automation SQL - get random value for each record

I need to populate some Data Extension using another Data Extension that contains all the accounts data. I want to attach a new column and the value for that column should be randomized from another Data Extension that contains some data. I've encountered a problem with putting the randomized value as an additional column - it randomizes the value but it puts the same value for all the records. I want to randomize different values for different records.

Table example with values that should be randomized:

Table name: Newsletter subscribers - data
id value
1 media
2 internet
3 life

and here is my SQL query:

SELECT *,
(SELECT TOP 1 value FROM [Newsletter subscribers - data] ORDER BY NEWID()) AS Content

FROM [Account]

I've tried also ORDER BY RAND() but it doesn't work as well...