Notices
The Basement Non-Honda/Acura discussion. Content should be tasteful and "primetime" safe.

Another SQL question - Please assist :)

Thread Tools
 
Old Oct 4, 2007 | 01:26 PM
  #31  
Pete's Avatar
Pete
Thread Starter
Civilian
 
Joined: Jun 2003
Posts: 8,407
Likes: 1
From: Miami Beach. FL
Default

Originally Posted by dieneverknowing
Why are you trying to get it to print 'overdue' if that wasn't part of the original task?
It said to list the date that the new test should be completed. If they are past that date then it should say "overdue".
Reply
Old Oct 4, 2007 | 01:32 PM
  #32  
dieneverknowing's Avatar
dieneverknowing
Senior Member
 
Joined: Nov 2006
Posts: 165
Likes: 0
From: jax fl
Default

Originally Posted by Pete
It said to list the date that the new test should be completed. If they are past that date then it should say "overdue".
From this?
Find all pilots that are either overdue on their flight proficiency check or need to have one within the next three months (a test is required every 6 months). List the pilot’s name, date of last check and the date it should be completed. Use the traditional method to solve the problem.
The only way I can think of accomplishing that is to do an IF statement, but I can't see the teacher requiring that if you haven't covered it. But let me look real quick and see what I can come up with
Reply
Old Oct 4, 2007 | 03:28 PM
  #33  
Pete's Avatar
Pete
Thread Starter
Civilian
 
Joined: Jun 2003
Posts: 8,407
Likes: 1
From: Miami Beach. FL
Default

Finally made some progress

Code:
TTITLE 'RobAir - Pilot Proficiency Test Status'
COLUMN pil_pt135_date -
HEADING 'Last Proficiency Test'
COLUMN req_test_date -
HEADING 'Next Proficiency Test'
SELECT (e.emp_fname ||' '|| e.emp_lname) Pilot, p.pil_pt135_date,
(ADD_MONTHS(p.pil_pt135_date,6)) req_test_date
FROM hartmar.employee e join hartmar.pilot p on e.emp_num = p.emp_num
;
It will show the pilots dates and thier required dates. I think I might be able to handle the rest. Will respond once I make more progress.
Reply
Old Oct 4, 2007 | 03:42 PM
  #34  
Pete's Avatar
Pete
Thread Starter
Civilian
 
Joined: Jun 2003
Posts: 8,407
Likes: 1
From: Miami Beach. FL
Default

Problem solved:

Code:
TTITLE 'RobAir - Pilot Proficiency Test Status'
COLUMN pil_pt135_date -
HEADING 'Last Proficiency Test'
COLUMN req_test_date -
HEADING 'Next Proficiency Test'
SELECT (e.emp_fname ||' '|| e.emp_lname) Pilot, p.pil_pt135_date,
(ADD_MONTHS(p.pil_pt135_date,6)) req_test_date
FROM hartmar.employee e join hartmar.pilot p on e.emp_num = p.emp_num
WHERE ADD_MONTHS(p.pil_pt135_date,6) < ADD_MONTHS(CURRENT_DATE,3)
;
I figured it out while reading the Oracle 9i: SQL book while I was on the shitter. It's amazing what you can accomplish while you are in there.
Reply
Old Oct 5, 2007 | 05:00 AM
  #35  
dieneverknowing's Avatar
dieneverknowing
Senior Member
 
Joined: Nov 2006
Posts: 165
Likes: 0
From: jax fl
Default

I figured it out while reading the Oracle 9i: SQL book while I was on the shitter. It's amazing what you can accomplish while you are in there.
Good job! :thumbup: Amazing what you can do on the toilet. I also see you didn't include that 'overdue' crap

The ADD_MONTHS is a lot better then just adding the days like I did. I believe I had the same book as you when I took SQL online. For some reason it wound up being the only book I didn't keep from all my programming classes. h:
Reply




All times are GMT -8. The time now is 01:46 AM.