Results 1 to 6 of 6

Thread: query problem

  1. #1
    Join Date
    Apr 2010
    Posts
    4

    Angry Unanswered: query problem

    hi guys,

    can....
    Last edited by pastus; 04-05-10 at 13:04.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Please realize that we don't have your tables & we don't have your data.
    Therefore we can't run, test or improve your posted SQL.
    It would be helpful if you provided DDL (CREATE TABLE ...) for tables involved.
    It would be helpful if you provided DML (INSERT INTO ...) for test data.
    It would be helpful if you provided expected/desired results & a detailed explanation how & why the test data gets transformed or organized.
    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
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    Well you could do it with 1 query if you added a bunch of case statements but it would be easier to do this;

    Code:
    SELECT cr.cruise_id, cr.cruise_name, sub.port_location,
      sub.start_date, sub.end_date
    FROM cruise cr
    LEFT JOIN (
      SELECT c.cruise_id, c.cruise_name, port_location,
        start_date, start_date + duration as end_date
      FROM cruise c 
      JOIN voyage v ON c.cruise_id = v.cruise_id
      JOIN port p ON c.port_no = p.port_no
      WHERE c.start_date >= current_date - 200
    ) sub ON cr.cruise_id = sub.cruise_id

  4. #4
    Join Date
    Apr 2010
    Posts
    4
    oh sorry.........





    thank u
    Last edited by pastus; 04-02-10 at 17:41.

  5. #5
    Join Date
    Apr 2010
    Posts
    4
    ................
    Last edited by pastus; 04-05-10 at 13:05.

  6. #6
    Join Date
    Aug 2009
    Location
    Olympia, WA
    Posts
    337
    knucklehead removed it because he was worried his professor would bust him.

    Doesn't really do a lot of good for anyone following behind you who may have a similar problem.

Posting Permissions

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