-
Help with Where/Case/Having
I have a program that looks for all of the projects in the database. I need to make a change where if the project starts with the letters 'MER' I have to exclude all resources with a code of 'CA'. If the project doesn't start with 'MER' I don't want to exclude any resources.
Here's the current code:
Select
LOC_ABBR,
PROJECT_NM,
RESOURCE_NM,
From PROJECT_TIME_ADJUSTMENTS PTA,
PHH_RESOURCE PR
Where PTA.RESOURCE_CD = PR.RESOURCE_CD
And CUTOFF_YR = 2003
And CUTOFF_MO = 02
Order By LOC_ABBR, PROJECT_NM, RESOURCE_NM
What's the best way to do this? I've tried changing the where statement, using a CASE statement, and a HAVING statement, but can't get it to work.
Any suggestions?
Thanks in advance.
-
Hope this meet your requirement
Select
LOC_ABBR,
PROJECT_NM,
RESOURCE_NM,
From PROJECT_TIME_ADJUSTMENTS PTA,
PHH_RESOURCE PR
Where PTA.RESOURCE_CD = PR.RESOURCE_CD
And CUTOFF_YR = 2003
And CUTOFF_MO = 02
And PROJECT_NM Like 'MER%'
And RESOURCE_NM Not Like 'CAL%'
Union
Select
LOC_ABBR,
PROJECT_NM,
RESOURCE_NM,
From PROJECT_TIME_ADJUSTMENTS PTA,
PHH_RESOURCE PR
Where PTA.RESOURCE_CD = PR.RESOURCE_CD
And CUTOFF_YR = 2003
And CUTOFF_MO = 02
And PROJECT_NM Not Like 'MER%'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|