Skip to content
Advertisement

SQL: Create an extra column with last 3 days date as a value

I have a table(users) with these sample data

From this table, i want to get the final output like below

if you see above output, for each day(last 3 days), i am seeing user,location,name data.

Can anyone suggest a solution for this

Advertisement

Answer

You seem to want a cross join:

You can easily adapt this for the last three days:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement