Help with SQL date evaluation

Reply

Join Date: Jun 2004
Posts: 4
Reputation: ehat is an unknown quantity at this point 
Solved Threads: 0
ehat ehat is offline Offline
Newbie Poster

Help with SQL date evaluation

 
0
  #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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Help with SQL date evaluation

 
0
  #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 Quick reply to this message  
Join Date: Jun 2004
Posts: 4
Reputation: ehat is an unknown quantity at this point 
Solved Threads: 0
ehat ehat is offline Offline
Newbie Poster

Re: Help with SQL date evaluation

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

Re: Help with SQL date evaluation

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1921 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Oracle
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC