Using IFF within a WHERE clause

  • I have a WHERE clause I need to add to a list of other WHERE clauses but this one below needs to evaluate to exclude based on two variables and this is pseudocode:

    WHERE IF Customer is between 99202 and 99215 and State is NY then exclude

    Should I be using "IFF" and what is the best syntax?:

    AND NOT (IFF(Customer between 99202 and 99215) and State = 'NY')

  • Don't need IIF, just standard WHERE NOT:

    WHERE NOT (Customer between 99202 and 99215 and State = 'NY')

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • That works perfectly... thx!

     

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply