Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 A conditional where clause, or something?

Author  Topic 

Scott
Posting Yak Master

145 Posts

Posted - 2002-01-28 : 07:54:18
I have the following:
select count(...)
from
...
"WHERE (dbo.Progress.PEnd > GetDate()) AND (dbo.WorkFlow.WorkFlowID = 1 OR dbo.WorkFlow.WorkFlowID = 2 OR dbo.WorkFlow.WorkFlowID = 3)

I also want:
"WHERE (dbo.Progress.PHandover > GetDate()) AND (dbo.WorkFlow.WorkFlowID = 4 OR dbo.WorkFlow.WorkFlowID = 5 OR dbo.WorkFlow.WorkFlowID = 6)

ie: I want to count all projects with PEnd > today and WorkFlowID = 1,2,3 AND all projects with PHandover > today and WorkFlowID = 4,5,6

The where queried field changes depending on the workflow.

Any ideas.
Thanks

Nazim
A custom title

1408 Posts

Posted - 2002-01-28 : 08:10:28
where (pend > getdate() and (workflowid in (1,2,3)) or
(phandover>getdate() and workflowid in(4,5,6))

Should do what you are looking for

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

ToddV
Posting Yak Master

218 Posts

Posted - 2002-01-28 : 08:38:15
quote:

where (pend > getdate() and (workflowid in (1,2,3)) or
(phandover>getdate() and workflowid in(4,5,6))





Extra open paren in there:

where (pend > getdate() and workflowid in (1,2,3)) or
(phandover>getdate() and workflowid in(4,5,6))


Go to Top of Page
   

- Advertisement -