如何在sql中加入两个表[关闭]

I have two table persons and order. I needto join these two tables.

$sql=mysql_query("select id from users");
 while($row = mysql_fetch_row($sq))
  {
   $id=$row['id']

  } 

now using this dynamic id I want to join table persons and order

table persons.

id  LastName    FirstName   Address     
1   Hansen      Timoteivn   Sandnes
2   Svendson    Tove        Sandnes
3   Pettersen   Kari        Stavanger

table orders

  id    orders  OrderNo
    1   y   1256
    2   n   11251
    2   m   5555

go to on this URL and read it

http://blog.sqlauthority.com/2009/04/13/sql-server-introduction-to-joins-basic-of-joins/

I think it is very helpful to understanding join in SQL...

Try this

SELECT * FROM `users` LEFT JOIN `orders` USING (`id`);