如下表
表t1
id xx
110 a表t2
id yy
110 b表t3
id xx
110 c
我用下面的代码可以查询到值:SELECT a.xx, b.yy, c.zz
FROM t1 AS a, t2 AS b, t3 AS c
WHERE a.id='110' and b.id='110' and c.id='110';但如果表t3没有id='110'这个值的时候,查询结果只看到表头了。
access数据库,这个要怎么弄?
表t1
id xx
110 a表t2
id yy
110 b表t3
id xx
110 c
我用下面的代码可以查询到值:SELECT a.xx, b.yy, c.zz
FROM t1 AS a, t2 AS b, t3 AS c
WHERE a.id='110' and b.id='110' and c.id='110';但如果表t3没有id='110'这个值的时候,查询结果只看到表头了。
access数据库,这个要怎么弄?
Select count(*) from 表名
如果这个查询语句的返回值为0的话,则表明这是个空表。
select a.xx,b.yy,c.zz from (t1 a left join t2 b on a.id=b.id) left join t3 c on a.id=c.id
FROM t1
INNER JOIN t2 ON t1.id=t2.id
LEFT JOIN t3 ON t2.id=t3.id
WHERE t1.id='110'Access的联表不要用别名。