Completing the where clause in sql server -
i have table kyc3
there walletno
, status
, rank
columns present. rank columns filled 0. while status column has following data: accepted, rejected, registered , scanned. want put value each status in rank column
accepted = 1, rejected = 2, registered = 3 , scanned = 4
i wrote following query not understand how complete it:
insert kyc3([rank]) select status_ kyc3
i understand need put clause indicate logic data population. should write?
you can use update
fill cell of existing row.
update kyc3 set rank = case when status = 'accepted' 1 when status = 'rejected' 2 when status = 'registered' 3 when status = 'scanned' 4 end
use insert
creating new rows.
Comments
Post a Comment