Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Unanswered: 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.

    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select Name
         , iif(isnull(ResidentialSuburb),
             , PostalSuburb
             , iif(ResidentialSuburb=''
                , PostalSuburb
                , ResidentialSuburb)) as Suburb
      from ...
    rudy
    http://r937.com/

  3. #3
    Join Date
    Oct 2003
    Posts
    2
    Thanks Rudy,

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

    Cheers
    Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •