Saturday, February 25, 2012

Returning one of two possible values

Hi guys,

I'm another newbie here.

I'm currently designing a small Access db that contains contact details:

Name
ResidentialSuburb
PostalSuburb

I need to create an SQL query that will return Name & "Suburb".
"Suburb" will contain ResidentialSuburb by default, but if this is empty, I would like it to contain PostalSuburb.

Is this possible? Im a bit stumped.

Thanksselect Name
, iif(isnull(ResidentialSuburb),
, PostalSuburb
, iif(ResidentialSuburb=''
, PostalSuburb
, ResidentialSuburb)) as Suburb
from ...
rudy
http://r937.com/|||Thanks Rudy,

Had a bit of a play around and it works a treat

Cheers
Matt

No comments:

Post a Comment