HI WELCOME TO KANSIRIS

Query to Copy Bulk data from one table to another table based on multiple case conditions

Leave a Comment
insert into table2(field1,field2,field3)
select field1,
(case when field2 < 10 then 0
when field2 >= 10 and field2 < 20 then 1
when field2 >= 20 and field2 < 30 then 2
when field2 >= 30 then 3
end) as field2,field3 from table1 group by field1

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.