re: Write a simple but impactful script VIEW POST

TOP OF THREAD FULL DISCUSSION
re: That's with T-SQL using a Tally table WITH L0 AS(SELECT 1 AS C UNION ALL SELECT 1 AS O), -- 2 rows L1 AS(SELECT 1 AS C F...
 

I'll see you and raise you Postgres :)

SELECT n1.v, n2.v, n3.v, n4.v
FROM (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) n1 (v)
CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) n2 (v)
CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) n3 (v)
CROSS JOIN (VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9)) n4 (v)
ORDER BY random();
 

Works like a charm in MSSQL if random() replaced with newid()! :)

code of conduct - report abuse