User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 456,507 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,682 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums
Views: 1253 | Replies: 3
Reply
Join Date: Jun 2004
Posts: 4
Reputation: ehat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ehat ehat is offline Offline
Newbie Poster

Help with SQL date evaluation

  #1  
Sep 26th, 2007
My query is below. I need to evaulate each row returned (and provide a "label" - shown with an astrick) based on the values in the 3 date columns and I'm stumped as to how to do it.

Here are my conditions and labels:
Action_Dt = Effdt AND Action_Dt < cutoff_dt- OK*
Action_Dt = Effdt AND Action_Dt > cutoff_dt - Noted*
Action_Dt > cutoff_dt AND Effdt < cutoff_dt - Late*
Action_Dt > cutoff_dt AND Effdt > cutoff_dt - Noted*
Action_Dt < cutoff_dt AND Effdt < cutoff_dt - OK*
Action_Dt < cutoff_dt AND Effdt > cutoff_dt - Data Entry Issue*

select P.NAME, C.CUTOFF_DT, J.ACTION_DT, J.EFFDT, Q.NAME
from PS_PERSONAL_DATA P,
ps_job j,
SYSADM.PS_DEPT_TBL D,
PS_PERSONAL_DATA Q,
SYSADM.PS_PAY_CALENDAR C
WHERE J.EMPLID = P.EMPLID
AND D.DEPTID = J.DEPTID
AND D.PM = Q.EMPLID(+)
AND J.PAYGROUP = C.PAYGROUP
AND J.EFFDT >= C.PAY_BEGIN_DT
AND J.EFFDT <= C.PAY_END_DT
and D.effdt = (select max(D1.effdt) from SYSADM.PS_DEPT_TBL D1
where D.DEPTID = D1.DEPTID)

Can it be done?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,444
Reputation: debasisdas is on a distinguished road 
Rep Power: 4
Solved Threads: 87
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: Help with SQL date evaluation

  #2  
Sep 27th, 2007
can you kindly post your table structure for reference of our experts in the forum.
Share your Knowledge.
Reply With Quote  
Join Date: Jun 2004
Posts: 4
Reputation: ehat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ehat ehat is offline Offline
Newbie Poster

Re: Help with SQL date evaluation

  #3  
Sep 27th, 2007
Do you mean a describe of each of the tables in my query?
Reply With Quote  
Join Date: Jun 2004
Posts: 4
Reputation: ehat is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ehat ehat is offline Offline
Newbie Poster

Re: Help with SQL date evaluation

  #4  
Sep 27th, 2007
Describes attached. Thanks!
Last edited by ehat : Sep 27th, 2007 at 11:21 am. Reason: Edit File with describes...
Attached Files
File Type: txt Query Table Describes.txt (15.1 KB, 2 views)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Oracle Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Oracle Forum

All times are GMT -4. The time now is 3:39 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC