select sum(a.ye) from table where a.date='20070731'
解决方案 »
- 一般的j2ee项目,SpringMVC3+Spring3+Hibernate3+Freemarker
- 如何过滤string中的<P>等html标签
- Structs的多语言问题
- jsp里面 是新图片拖拉的效果?
- 100分求助:jdbc中如何捕获MySQLSyntaxErrorException
- Arrays.asList问题
- 文件下载
- 请问如何配置web.xml才能在输入http://localhost:8080/ProjectName后自动调用一个servlet
- 如何调试JSP程序呢?能否在服务器端调试?
- 书不在 <jsp:forward page="/landmis/operation/OfficeTaskList.jsp"/> 是啥意思
- 新手弱弱的问:关于<c:set />和<jsp:useBean>的问题
- 关于logic标签(在线等待)
select a.name,sum(case when a.date = '20070731' then a.ye end)
,sum(case when a.date = '20070631' then a.ye end)
,sum(case when a.date = '20060731' then a.ye end)
from people a where a.date in ('20070731' ,'20070631' ,'20060731' )
现实用的时候people表还关联了很多个相关的表.
这样如何优化?
你写三条select sum(a.ye) from table where a.date='20070731'
都比你上面那条效率高得多。