一次sql排序的问题。
2016-03-09 18:11
281 查看
![](http://images2015.cnblogs.com/blog/834416/201603/834416-20160309181032694-1370676739.png)
select date, count(fail) as fail,count(win) as win from
(select date,(case (result) when 'fail' then 'fail' end ) as fail,(case (result) when 'win' then 'win' end ) as win from games
) d group by date
![](http://images2015.cnblogs.com/blog/834416/201603/834416-20160311164202272-2026417096.png)
select Name, Year , Month ,Count(Amount) as Income from
(select b.Name ,a.[Year] as Year ,a.[Month] as Month ,a.Amount as Amount from Test_Amount a left join Test_Users b on a.UserId=b.Id )
c group by Name,Year,Month
相关文章推荐
- 两个远程数据库之间get数据
- mongodbtemplate配置
- jedis调用redis之事物
- Oracle特殊字段处理--工作备忘2016/03/09
- MySQL数据库中表类型MyISAM与InnoDB的区别
- 关于sqlite的特殊字符转义及通配符
- jedis调用redis之pool
- SQL分组统计:由一个表的两列作为轴
- zabbix监控mongodb
- Oracle学习笔记——1、基本的SQL语句
- Microsoft SQL Server 2005 Service fails to start
- percona-toolkit系列之介绍和安装(mysql复制工具)
- oracle备份imp命令大全
- ora-02064不支持分布式操作与Oracle自治事务
- PostgreSQL 三节点集群故障模拟及恢复
- jedis调用redis之分页
- 防止mysql注入
- mysql int转换成string时类型要用char
- Gneymotion无法启动和Oracle VM VirtualBox常见问题
- 踩坑事件:不能对基于文本的临时表使用sql insert语句