I feel like this should be simple, but I'm having trouble. First let me explain what I'm trying to do. I have three variables - JournalVisible, OnlineVisible, NJMVisible. If the respective variable is true, then I want to return rows in my query where those (either Journal, Online or NJM) exist.
For instance, if JournalVisible and OnlineVisible are true, then I want to return the rows where the JobType columns are either Journal or Online, but not NJM.
Here is what I have in my Where clause, but it is giving me an error....
and (CASE WHEN @JournalVisible = 1 THEN mj.JobTypeID = 10 END) and (CASE WHEN @OnlineVisible = 1 THEN mj.JobTypeID = 9 END) and (CASE WHEN @NJMVisible = 1 THEN mj.JobTypeID = 11 END)
Thanks.

New Topic/Question
Reply




MultiQuote








|