944,100 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Unsolved
  • Views: 2275
  • Oracle RSS
Sep 26th, 2007
0

Help with SQL date evaluation

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ehat is offline Offline
4 posts
since Jun 2004
Sep 27th, 2007
0

Re: Help with SQL date evaluation

can you kindly post your table structure for reference of our experts in the forum.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Sep 27th, 2007
0

Re: Help with SQL date evaluation

Do you mean a describe of each of the tables in my query?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ehat is offline Offline
4 posts
since Jun 2004
Sep 27th, 2007
0

Re: Help with SQL date evaluation

Describes attached. Thanks!
Attached Files
File Type: txt Query Table Describes.txt (15.1 KB, 10 views)
Last edited by ehat; Sep 27th, 2007 at 11:21 am. Reason: Edit File with describes...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ehat is offline Offline
4 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: Differences between versions of oracle
Next Thread in Oracle Forum Timeline: Problems starting Oracle





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC