我如何加入两个表ID AUTO_INCREMENT
我需要这样的结果我将在下面显示示例。我想要的是什么。
Table1 | Table2
-----------------------|-----------------------
userid | name | f_name |userid | work | study
-----------------------|-----------------------
1 | ali | amjad |1 | yes | no
-----------------------|-----------------------
2 | aff | mff |2 |no |yes
Table1
和Table2
用户ID应该相同。
答案 0 :(得分:0)
SELECT t1.userid, t1.name, t1.f_name, t2.userid, t2.work, t2.study
FROM Table1 t1 INNER JOIN Table2 t2
ON t1.userid = t2.userid
答案 1 :(得分:0)
你能试试吗,
select Table1.userid,Table1.name,Table1.f_name,Table2.userid, Table2.work,Table2.study from Table1, Table2 where Table1.userid=Table2.userid