Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Max from multiple columns
create table test(id int, col1 int, col2 int, col3 int) insert into test values(10, 24,45, 32) select * from test t1 cross apply( select max(col1) max_value from (select col1 union select col2 union select col3) t1) t2 select id, max(case oper when 1 then col1 when 2 then col2 when 3 then col3 end) max_value from test t1 cross join (values (1),(2),(3)) t2(oper) group by id
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
create table employees as e. No, e. Name., e. Phone no, e. Salary
q
Split name
Terceiro
Employee
Jean
Teacher
Resolved error
Stuff code in sql
megha
Please log in to post a comment.