Home Forums SQL Server 2005 T-SQL (SS2K5) Where condition not equal to multiple columns - PUZZLE - who can solve this? RE: Where condition not equal to multiple columns - PUZZLE - who can solve this?

  • *facepalm* sorry about the earlier code. Try this again:

    Alternatively:

    SELECT

    *,

    CASE WHEN column2 <> 'AP' THEN 1 ELSE 0 END AS APtest,

    CASE WHEN column3 <> 'U' THEN 1 ELSE 0 END AS Utest,

    CASE WHEN column2 <> 'AP' AND column3 <> 'U' THEN 1 ELSE 0 END AS APUtest

    FROM

    @Table1

    WHERE

    NOT ( column2 = 'AP' AND column3 = 'U')


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA