Results 1 to 4 of 4

Thread: Complex Query

  1. #1
    Join Date
    Jul 2008
    Posts
    4

    Unanswered: Complex Query

    hi,
    I have one problem
    My table struture as follows:
    1)Table 'A' Card_id Date intime outtime
    card_id varchar 30002 20/7/2008 10:00 18:12
    date date 30001 20/7/2008 10:12 18:30
    intime bigint 30003 20/7/2008 10:50 18:00
    outtime bigint

    2)Table 'B'
    card_id varchar Card_id emp_id Name Desgn
    emp_id varchar 30001 30143786 Deepak Developer
    Name varchar 30002 30005123 Aditya Project Manager
    Desgn varchar 30003 30258963 Abhijit Team Leader
    30004 30147852 Sujit Developer

    3)Table 'C'
    Card_id varchar Card_id leave_id from_date to_date reason
    leave_id integer 30003 1 19/7/2008 20/7/2008 Train Late
    from_date date 30004 2 20/7/2008 20/7/2008 CL
    to_date date
    reason varchar

    i want Report foll format

    Name Designation Card Id InTime OutTime Reason
    Aditya Project Manager 30002 10:00 18:12 -
    Deepak Developer 30001 10:12 18:30 -
    Abhijit Team Leader 30003 10:50 8:00 Train Late
    Sujit Developer 30004 Absent - CL


    i developed one query but problem occurred problem is They only show records that Reason present on that particular Card_id and Date.

    Thanks in Advanced
    Last edited by deepsfriend4u; 07-23-08 at 04:28.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    SELECT b.name
         , b.desgn As [designation]
         , b.card_id
         , a.intime
         , a.outtime
         , c.reason
    FROM   table_b As [b]
     INNER
      JOIN table_a As [a]
        ON b.card_id = a.card_id
     LEFT
      JOIN table_c As [c]
        ON b.card_id = c.card_id
    George
    Home | Blog

  3. #3
    Join Date
    Jul 2008
    Posts
    3

    better information

    I have saw your new train time sechudle

    Aditya Project Manager 30002 10:00 18:12 -
    Deepak Developer 30001 10:12 18:30 -
    Abhijit Team Leader 30003 10:50 8:00 Train Late

  4. #4
    Join Date
    Jul 2008
    Posts
    4
    Quote Originally Posted by georgev
    Code:
    SELECT b.name
         , b.desgn As [designation]
         , b.card_id
         , a.intime
         , a.outtime
         , c.reason
    FROM   table_b As [b]
     INNER
      JOIN table_a As [a]
        ON b.card_id = a.card_id
     LEFT
      JOIN table_c As [c]
        ON b.card_id = c.card_id
    if i use above Query then i get result but i want also thoes record which not have REASON for e.g. as follows:
    Name Desg Card_id Intime Outtime Reason
    Aditya Project Manager 30002 10:00 18:12 -
    Deepak Developer 30001 10:12 18:30 -

Posting Permissions

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