select a.id,a.name,b.id,b.address,b.tell,c.id,c.time from 表A a,表B b,表C c where name='"+name+"'and a.id=b.id and b.id=c.id and c.id=a.id
...全文
64804打赏收藏
三个表关联查询,SQL语句该怎么写
比如我有三个表 表A ID NAME 表B ID Address tell 表C ID Time 其中ID是相关联的,ID是表A的主键,其他表的外键,我现在想输入一个姓名去查询表A的ID,然后根据ID区查询其他两个表的地址,电话和时间,结果倒是可以查询出来,但是很多结果是重复的,有什么问题呢? select a.id,a.name,b.id,b.address,b.tell,c.id,c.time from 表A a,表B b,表C c where name='"+name+"'and a.id