To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 02-24-2003, 12:11 PM
mitchg mitchg is offline
Junior Member
 
Join Date: Feb 2003
Posts: 1
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.
Reply With Quote
  #2  
Old 02-25-2003, 04:01 AM
monalisag monalisag is offline
Junior Member
 
Join Date: Feb 2003
Posts: 14
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%'
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:14 AM.


DatabaseJournal Recent Articles


 » Preparing To Upgrade Access Tables to SQL ...

 » Microsoft Windows PowerShell and SQL Serve...

 » New MySQL Enterprise with Query Analyzer B...

 » Quest Software Strengthens Committment to ...

 » Oracle Unveils New Event-Driven Middleware...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.