Mysql语句,脑子又卡主,求助一下 数据:id num type1 5 圆珠笔 //id1的人有5支圆珠笔1 4 钢笔2 6 钢笔3 5 钢笔需要得到的结果id 钢笔 圆珠笔1 4 52 6 03 5 0 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select id, sum(if(type='钢笔',1,0)) as 钢笔, sum(if(type='圆珠笔',1,0)) as 圆珠笔from 数据group by id MySQL交叉表http://blog.csdn.net/acmain_chm/article/details/4283943 select id, sum(if(type='钢笔',1,0)) as 钢笔, sum(if(type='圆珠笔',1,0)) as 圆珠笔from 数据group by id Mysql float类型存放超过百万的数字会自动变成整数并且在个位数上进行四舍五入 求一mysql函数 返回一个号码的所有组合 我做新闻网站时正文内容如何在数据库中设置? mysql事务请教 关于MySql更新的问题,请高手帮帮忙! 菜鸟求教一个问题,mediumint(8)的8究竟是什么意思??? 50分请教一个MYSQL数据库更新的语句 请看这个sql语句 请问各位,MYSQL中的三种表格式都有什么区别啊? 为何二种连接不同? 你们看看这sql语句能优化不? 求sql
sum(if(type='钢笔',1,0)) as 钢笔,
sum(if(type='圆珠笔',1,0)) as 圆珠笔
from 数据
group by id
http://blog.csdn.net/acmain_chm/article/details/4283943
sum(if(type='钢笔',1,0)) as 钢笔,
sum(if(type='圆珠笔',1,0)) as 圆珠笔
from 数据
group by id