using case in where clause

  • I am trying to do the following: Check if the inspection != 'value', if it doesn't filter using where, otherwise no filtering is necessary.

    This obviously doesn't work as case need to return a value, but something to the effect of:

    select * from table

    case when inspection != 'permit' then where OverDue is not null end

    Any ideas?

    Thanks

  • where

    inspection='permit' or

    overdue is not null

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Well now I just feel stupid. 🙂

    Thanks for the help Matt.

  • bubs (10/16/2014)


    Well now I just feel stupid. 🙂

    Thanks for the help Matt.

    Oh I have my share of those 🙂 . Don't feel that way - it's usually a matter of staring at something for too long!

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

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

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