Oracle
戴武宁
Oracle/Java/Delphi
展开
-
一条语句轻松写出一个报表(含明细、小计、合计、总计)
select x1,x2,x3... from (with mx as (select x1,x2,x3,(select x4 from m where ... and rownum from x,y,zwhere ... )select x1,x2,x3... from mxunion allselect x1,x2,'' x3,...sum(x7原创 2012-01-20 09:36:46 · 1625 阅读 · 0 评论 -
PL/SQL SELECT 查询
with重用子查询:with a as (select * from b where xxx)select * from a where xxx;层次查询:select * from a where 1=1 start with id = root connect by prior parent = id合并查询:union 去掉重复记录;union all 包含重复记原创 2012-01-20 09:23:01 · 299 阅读 · 0 评论 -
Case语句
SELECT LogID,UserID,LogTime,Url,Description,(case OperateType when OperateType = 0 then ‘新增’ when OperateType=1 then ‘修改’ else ‘删除’ end case) FROM LOG1. caseSELECT LogID,UserID,LogTime,Url,Descrip原创 2012-01-20 09:26:23 · 379 阅读 · 0 评论