Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    20

    Question Unanswered: Sysdate in SQL Plus

    I have this code:
    select distinct pil_pilotname, dep_dep_date
    from departures, pilots
    where dep_dep_date < sysdate
    and dep_pilot_id = pil_pilot_id;

    The result gives me:
    PIL_PILOTNAME DEP_DEP_D
    ------------------------------ ---------
    Leiss, Ernst L. 19-APR-09
    Harris, Kenneth C. 18-APR-09
    Long, Stuart 18-APR-09
    Long, Stuart 19-APR-09
    Long, Stuart 08-APR-09
    Harris, Kenneth C. 08-APR-09
    Leiss, Ernst L. 08-APR-09
    Pasewark, William B. 10-APR-09
    Harris, Kenneth C. 02-APR-09

    PIL_PILOTNAME DEP_DEP_D
    ------------------------------ ---------
    Pasewark, William B. 17-APR-09
    Pasewark, William B. 01-APR-09
    Harris, Kenneth C. 19-APR-09
    Pasewark, William B. 08-APR-09

    I'm trying to retrieve only the most recent departure date for each pilot. What am I missing?

    Thanks.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >What am I missing?
    You are missing the filter to return "only the most recent departure date for each pilot".
    MAX()
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Apr 2009
    Posts
    20
    thanks. it works great now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •