有两个table
table1(aid,name)
table2(cid,aid,message)table1 data:
1,abc
2,def
3,xyztable2 data:
1,1,hello
2,1,hi
3,2,welcome我想在取出table 1的所有资料时,也可以知道有多少纪录在table2里SELECT Count(*) AS [count], table1.name
FROM table1 INNER JOIN table2 ON [table1].aid=[table2].aid group by table1.name;结果:
count,name
2,abc
1,def这句显示不到纪录3的资料,请问如何显示为:
2,abc
1,def
0,xyz谢谢
table1(aid,name)
table2(cid,aid,message)table1 data:
1,abc
2,def
3,xyztable2 data:
1,1,hello
2,1,hi
3,2,welcome我想在取出table 1的所有资料时,也可以知道有多少纪录在table2里SELECT Count(*) AS [count], table1.name
FROM table1 INNER JOIN table2 ON [table1].aid=[table2].aid group by table1.name;结果:
count,name
2,abc
1,def这句显示不到纪录3的资料,请问如何显示为:
2,abc
1,def
0,xyz谢谢
解决方案 »
- mysql如何把user表的password字段32位MD5加密啊
- 求教:关于mysql中文查询的问题 最近在做一个网站,是用mysql作数据库,用dreamweaver设计jsp网页。
- mysql中如何建立数据库?新手,求指教。
- mysqldump 导出的sql文件中中文乱码了,原库已损坏,如何转码?
- 请教mysql锁表问题
- 请问各位大侠,要实现MYSQL加密传输,应该怎么做?
- MYSQL中是否能对所有表中里的所有数据进行字符替换?如何实现?
- front
- Linux下如何开启Mysql的更新日志?
- 求大神 Mysql 怎么查看远程登陆日志
- 批量修改,更新数据!(急!)
- 如何将一个文本文件导入到mysql里成为一个单独的表?(在线等)
[count] = (select count(1)
from table2
where table2.aid = table1.aid),
name
from table1
[count] = (select count(1)
from table2
where table2.aid = table1.aid),
[name]
from table1
from complain
where table2.aid = table1.aid' at line 2