可能重复:
SQL 查询如何从多个表中返回数据
请帮我解决这个问题,我有 2 个 mysql 表,
tbl_product
id name title userID
1 Phone N95 1
2 Tab Google 1
3 Laptop Toshiba 1
4 PhoneNext Nokia 2
5 Mp3 Player Apple 2
6 Gallexy Samsung 3
7 Hard 320GB 6
tbl_user
id selName
1 Jhon
2 Khan
3 Mohomad
4 Ann
6 Ricky
我需要得到这样的输出加入这两个表,
Phone N95 (userID = 1)
Tab Google (userID = 1)
Laptop Toshiba (userID = 1)
约翰 (id=1)
PhoneNext Nokia (userID = 2)
Mp3 Player Apple (userID = 2)
汗 (id=2)
Gallexy Samsung (userID = 3)
穆罕默德 (id=3)
请大家帮帮我谢谢大家......
I Need to get Like This out put,
<table width="224" border="1"> <tr> <td width="214">Phone N95 (userID = 1)</td> </tr> <tr> <td>Tab Google (userID = 1)</td> </tr> <tr> <td>Laptop Toshiba (userID = 1)</td> </tr> <tr> <td align="right" bgcolor="#FFFF99">Jhon (id=1)</td> </tr> <tr> <td>PhoneNext Nokia (userID = 2)</td> </tr> <tr> <td>Mp3 Player Apple (userID = 2)</td> </tr> <tr> <td align="right" bgcolor="#FFFF99">Khan (id=2)</td> </tr> </table>