var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Nesting IIF in SQL
Hello, I need some help with nesting an IIF.
Lets say I have a table like this,
Gender, initials, name, address, postalcode, town
male, J., Ivens, Javalaan 3, B1015, Bruxelles
female, K., Kwakman, Boumablv. 4, 9600 AA, Groningen
unknown , A., Robben, Brink 200, 9411 BB, Bedum
I want to join some of this data in new columns, I came up with this,
SELECT IIF(gender='female', 'Ms.','Mr.') & (' ' & initials & ' ' & name) AS column1,
(address) AS column2,
(postalcode &' ' & town) AS column3
With this result,
column1, column2, column3
Mr. J. Ivens , Javalaan 3, 1015 Bruxelles Belgium
Ms. K. Kwakman, Boumablv. 4, 9600 AA Groningen
Mr. A. Robben, Brink 200, 9411 BB Bedum
Now for that last record the gender is unknown. I want it to read "Mr./Ms. A. Robben" instead of "Mr. A. Robben".
How do I do this? I thought of nesting that IIF but I can't figure it out.
Thanks in advance
SELECT IIF( gender='male' , 'Mr.'
, IIF( gender='female' , 'Ms'
, 'Mr./Ms') )
& ' ' & initials & ' ' & name AS column1
, address AS column2
, postalcode & ' ' & town AS column3
That works, thanks. These are my first steps from dBase to Access. Quick help like this will make things easier