Use one select query for two different table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Schetan
    New Member
    • Mar 2008
    • 4

    Use one select query for two different table

    hi,
    I am working in asp.net with sqlserver2005. i am stored car information in one table an image for that car in other table. i can also stored that image id with respective car. I want to show some car information with it photo in datagrid.
    But how can i select that both table in on single query

    Please guide me.

    Thanks
    Schetan
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #2
    Hi
    if you able to display the data selected in sql query then the select statement is
    Code:
    select a.fieldname1,a.fieldname2,a.fieldname3,b.fieldname1,b.fieldname2,b.fieldname3 from table1 a,table2 where a.fieldname1=b.filedname2
    in where clause one filed data is common in both table for jointing them
    Regards
    jha

    Comment

    • vikas251074
      New Member
      • Dec 2007
      • 198

      #3
      Originally posted by idsanjeev
      Hi
      if you able to display the data selected in sql query then the select statement is
      Code:
      select a.fieldname1,a.fieldname2,a.fieldname3,b.fieldname1,b.fieldname2,b.fieldname3 from table1 a,table2 where a.fieldname1=b.filedname2
      in where clause one filed data is common in both table for jointing them
      Regards
      jha

      I am sure this will not work because image will not display this way. There could be another method.

      Thanks and regards,
      Vikas

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by vikas251074
        I am sure this will not work because image will not display this way. There could be another method.

        Thanks and regards,
        Vikas
        Idsanjeev's solution is correct. He did not address the question of displaying the photo, just how to query both tables with a single query.

        Jared

        Comment

        Working...