I have a table called sinvent with columns accno, jno, and saccno. jno and saccno are already filled with numbers, alot of the numbers repeat.i need to populate accno with the following values based on which jno its associated with. how do i write a single query to do this?
accno = 4010 for jno < 09999
accno = 4011 for jno = 00011
accno = 4012 for jno = 00012
accno = 4714 for jno = 00014
accno = 4018 for jno > 80000 and jno < 99998
accno = 4008 for saccno = 7 and 8
accno = 4714 for jno = 04714 and 4714
any help would be greatly appreciated.
ive tried to use
update sinvent
set
accno = '4010' where jno < '09999',
accno = '4011' where jno = '00011'
but it says a column cannot be assigned more than one value in the same clause
You have to use CASE inside the UPDATE statement: