Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

关于mysql多表查询,每个表都有ID字段,怎样获得a表的id呢

有以下一个mysql查询语句,多表查询的,我怎么在查询结果中获取到A表的id呢,以下三张表中都有id字段,直接从结果获取id的话 返回的是c表的id 而不是a表的id

select * from dr_1_order AS a, dr_1_activity AS b,dr_1_activity_form_activity_bm AS c  where a.buy_uid = $uid and b.id = a.activity_id and a.mid = 9 and c.id = a.bmid  $timess order by a.order_time desc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

参考此处 mysql多表查询,相同字段怎样分别显示 ,因为三个表中有相同的id字段,要给它起个别名就行了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...