-
问题内容:求一句MYSQL语句
- 原讨论链接:http://community.csdn.net/expert/topicview1.asp?id=5295880
- 所属论坛:Web 开发
审核组:JAVA
- 提问者:sqqd1234
解决者:yzh963
- 感谢:yzh963
- 关键字:字段 语句 Java Web 开发 count select 记录 content table1 查出 aa.a bb.b
- 答案:
我有一个表
table1
字段1 字段2
content id自增
好 1
不好 2
一般 3
好 4
一般 5
。。
。。。
。。
我想查出字段 好的记录。不好的记录。一般的记录来。怎么查啊
---------------------------------------------------------------
select aa.a as '好',bb.b as '一般',cc.c as '不好' from
(select count(content) as a from table1 where content='好') aa,
(select count(content) as b from table1 where content='一般') bb,
(select count(content) as c from table1 where content='不好') cc
- 评价:
给朵鲜花(1)
扔个鸡蛋(0)