php,sql读表一时想把表二的字段也读出来,表二条件是表二中的uname对于表一的uname,求大神

[复制链接]
查看11 | 回复5 | 2013-4-28 16:30:02 | 显示全部楼层 |阅读模式
SELECT * FROM table1 as t1 LEFT JOIN table2 as t2 ON t1.uname=t2.uname WHEREt1.aid = '$aid'...
回复

使用道具 举报

千问 | 2013-4-28 16:30:02 | 显示全部楼层
table1 字段aid,uname,timeid表二:table1 字段uname,qq[td]姓名[/td][td]时间[/td][td]QQ[/td][/tr]
SetQuery("Select ...
回复

使用道具 举报

千问 | 2013-4-28 16:30:02 | 显示全部楼层
$dsql->SetQuery("Select *from table2`uname`='$row->uname' ");$dsql->Execute();...
回复

使用道具 举报

千问 | 2013-4-28 16:30:02 | 显示全部楼层
select table1.*,table2.* from table1,table2 where table2.uname=table1.uname;...
回复

使用道具 举报

千问 | 2013-4-28 16:30:02 | 显示全部楼层
两表联合查询SELECT table1,table2 FROM table1 LEFT JOIN table2 WHERE table1.aid= '$aid' ON table1.uname = table2.uname这种联合查询的限制是ab2表必须有一个相同的关键字,且相等希望能帮到你...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行