Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Posts
    2

    Unanswered: how to fetch records

    Hello,

    I have two tables and following are the structure of both the tables

    Tbale 1
    Field1 Field2 Field3
    d1 01 26/03/2011
    d2 02 26/03/2011
    d3 03 27/03/2011

    Table2
    Field1 Field2 Field3
    01 6.15 14.25
    02 7.30 16.25
    03 6.00 18.25


    I wanted an output like the following if i search records by table1.field3 (say 26/03/2011)



    Tbale 1
    Table1.Field1 Table2.Field2 Table3.Field3 Table2.field2 Table2.Field3
    d1 01 26/03/2011 6.15 14.25
    d2 02 26/03/2011 7.30 16.25
    d3 03 27/03/2011


    Inorder to get the above result, what query should i write?

    Kindly help me.

    Thanks
    Nick

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by nicklibee View Post
    I wanted an output like the following if i search records by table1.field3 (say 26/03/2011)
    your sample data doesn't make any sense

    why is d3 in the output? it does not meet the search condition 26/03/2011

    looks like you over-simplified your problem and fooled yourself

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    I wanted to retrive all the records from table1 and only the matching records in table 2; thats the reason why d3 is there
    thanks
    nick

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by nicklibee View Post
    I wanted to retrive all the records from table1 and only the matching records in table 2; thats the reason why d3 is there
    so could you please explain this --
    I wanted an output like the following if i search records by table1.field3 (say 26/03/2011)
    please explain why that criterion (the red part) also returns d3
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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