Hi!
I have a query question for all you query experts out there. The query I am trying to run is unbelievably simple, however because of the way the program is written I pretty much only have access to parts of the where clause.
Here's what I'm trying to do:
Select count(*) from TBL where Status = 1 and Code = 2 and (Name NOT IN ('Smith') or (Status = 8 and Misc = 'Y');
Basically, I need to select everything where:
Status = 1 AND Code = 2 OR
Status = 8 AND Code = 2 and MISC = Y
This would be easy if I could just write
select count(*) from TBL where
(Status = 1 or (Status = 8 AND Misc = 'Y')) AND Code = 2
But I don't have access to the first reference to Status.
Is there a way I could do an additional select statement after it grabs Status 1 and code 2? Let me know if this doesn't make sense. 🙂 (By the way, getting the name not in smith is not important).
Thanks!!
Lisa