SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with a as ( select 'red' as color union all select 'yellow' as color union all select 'green' as color union all select 'meow' as color union all select 'test' as color union all select 'black' as color union all select 'white' as color ) select c1, c2 from ( select a.color c1, b.color c2 --, a.n, b.n, a.n + b.n summ, a.n * b.n mult , (a.n * b.n) * (a.n + b.n) + (a.n + b.n) total_value , row_number() over(partition by (a.n * b.n) * (a.n + b.n) + (a.n + b.n) order by (a.n * b.n) * (a.n + b.n) + (a.n + b.n)) n from ( select color, row_number() over(order by color) n from a ) a cross join (select color, row_number() over(order by color) n from a) b where a.n != b.n ) t where n = 1 order by c1, c2
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear