T-SQL Syntax Issue Else if style logic
- by Yoda
Hi guys, two questions today, I'm a busy bee and luckily I have an awesome community at my disposal!
My issue here is this:
I have a field i need to update based on existing field data.
If Gender = F then foo = 1
If Gender = M then foo = 2
If Gender = Male then foo = 2
If Gender = Female then foo = 1
If Gender is not above then foo = 3
Here is what I have:
update EmailAddresses
set Priority1 = '1'
where GENDER__C = 'Female'
update EmailAddresses
set Priority1 = '2'
where GENDER__C = 'Male'
update EmailAddresses
set Priority1 = '1'
where GENDER__C = 'F'
update EmailAddresses
set Priority1 = '2'
where GENDER__C = 'M'
update EmailAddresses
set Priority1 = '3'
where GENDER__C not in (select 'Female', 'Male', 'F', 'M')
Any help much appreciated! And its Friday!! Whoo hoo