Single query to fetch data from two tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravisuguna
    New Member
    • Dec 2007
    • 15

    #1

    Single query to fetch data from two tables

    Hi,

    I have two tables in database .They have one field in common.
    I want to fetch data from both the tables through a single query.How could this be done?Pl help me


    Thanks in advance
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Use JOIN to fetch the data from both tables. e.g.
    [CODE=mysql]SELECT * FROM table1
    INNER JOIN table2 ON table1.common_f ield = table2.common_f ield[/CODE]

    Comment

    Working...