Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: multiple conditions on a case

    how do i properly code the following?

    Code:
    case 
       when tab1.col1 = 1 and tab2.col1 = 0
         then 'no'
       when tab1.col1 = 1 and tab2.col1 = 1
         then 'yes'
       when tab1.col1 = 2
         then 'na'
    end as Applicability
    thanks in advance.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    The syntax is fine. Do you mean the logic? You do of course miss certain condition combinations.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jul 2006
    Posts
    111

    ...

    that was strange i tried it before asking you and it didn't work... after you answered it did... hmm...
    thanks by the way

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    pootle flump
    mystic code enabler
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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