1
select userlist.userid,userlist.username,userinformation.address from userlist left join userinformation on userlist.userid=userinformation.userid
然后,再把查询数据,插入到新表即可
只要在上面的语句,加上插入这句sql就可以了,最终语句如下
1
insert into `user` select userlist.userid,userlist.username,userinformation.address from userlist left join userinformation on userlist.userid=userinformation.userid
select user.userName,count(affair.tech)from user left join affair on user.userName=affair.tech
group by user.userName
select U.My_User_ID,U.My_User_Name,count(A.My_Article_UserID) as User_Count From My_User as U left join My_Artcile as A on U.My_User_ID = A.My_Article_UserID-- 查询两张表,分别取别名 U 和 A。左联A表查询。on是两张表的条件(两个id对应)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)