首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

来接下分->轻松下~该怎么解决

2012-01-30 
来接下分----轻松下~~~~我吐血````前段时间有个”高“人走人```他写的东西我接手``发个经典的视图给你们看

来接下分---->轻松下~~~~
我吐血````前段时间有个”高“人走人```他写的东西我接手``发个经典的视图给你们看下```一点文档都没留下...不知道从哪里下手改```简直是砸我饭碗.哎``
create   or   replace   view   elappadm.v_empl_money   as select   Pay_type,employees_id,class_id,money,Month   from (select   '0 '   Pay_type,a.employees_id,a.class_id, decode(c.Fixed,1, decode(a.money*decode(d.native_wb,1,Total_coefficient*b.Personal_rate,b.total_wrate*b.personal_wrate),null,a.money,a.money*decode(d.native_wb,1,Total_coefficient*b.Personal_rate,b.total_wrate*b.personal_wrate)), -decode(a.money*decode(d.native_wb,1,Total_coefficient*b.Personal_rate,b.total_wrate*b.personal_wrate),null,a.money,a.money*decode(d.native_wb,1,Total_coefficient*b.Personal_rate,b.total_wrate*b.personal_wrate))) as   money, ' '   as   month   from   t_al_welfare   a,T_Insurance_class   b,v_xcfl_class   c,t_employees   d where   a.class_id=b.Class_Id(+) and   a.class_id   not   in( 'A-01 ',   'A-02 ', 'A-03 ', 'A-04 ', 'A-05 ') and   (a.class_id=c.Class_Id   or   b.class_id=c.Class_Id)   and   d.employees_id=a.employees_id union select   pay_type,employees_id,class_id,-sum(money)   as   money,month   from   (select   '1 '   Pay_type,employees_id   , 'A-03 '   class_id,Punish_money   money,Kq_Month   as   month from   T_Kq_hz)   group   by   pay_type,employees_id,class_id,month union select   '0 '   Pay_type,Employees_id, 'A-01 '   Class_id,Pay_money   as   money, ' '   as   month   from   T_Employees   a,T_Pay_class   b   where   a.PAY_ID=b.PayClass_id union select   '1 '   Pay_type,q.employees_id, 'A-02 '   as   Class_id,q.money*decode(w.bonus_rate,null,1,w.bonus_rate)   money, q.month   from   (select   m.employees_id,m.money,m.month,n.deptid   as   tdeptid   from   v_bonus_money   m,t_employees   n where   n.employees_id=m.employees_id   )   q,T_Bonus_rate   w   where   w.ydate(+)=q.month   and   w.deptid(+)=q.tdeptid   union   select   '0 '   Pay_type,b.employees_id, 'A-05 '   Class_id,(b.Work_years*a.SUBVENTION_JE)as   money, ' 'as   month   from   T_Employ_Class   a,t_employees   b   where   b.Emp_classID=a.emp_classid   and   b.work_years <=a.max_year) union select   '1 '   Pay_type,g.work_num   as   employees_id, 'A-04 ',g.price*h.fini_num   as   money,to_char(h.writ_time, 'yyyymm ')   as   month   from   (select   f.PRICE,e.seqn_num,e.Work_num   from   t_prod_proc   f, (select   m.seqn_num,m.Bill_id,m.Proc_id,m.seq,m.Work_num,n.PROD_CODE   from   T_task_dist   m,(select   b.PROD_CODE,a.bill_id   from   t_prod_info   a,v_t_bom_base   b   where   a.bom_id=b.bom_id)   n   where   m.bill_id=n.bill_id   and   m.dist_type= '1 ' union select   c.seqn_num,c.Bill_id,c.Proc_id,c.seq,d.g_manger   as   work_num,c.PROD_CODE   from   (select   m.seqn_num,m.Bill_id,m.Proc_id,m.seq,m.Work_num,n.PROD_CODE   from   T_task_dist   m,(select   b.PROD_CODE,a.bill_id   from   t_prod_info   a,v_t_bom_base   b   where   a.bom_id=b.bom_id)   n   where   m.bill_id=n.bill_id   and   m.dist_type= '2 ')c,t_group   d   where   c.Work_num=d.group_id)e where   f.Proc_id=e.Proc_id   and   f.seq=e.seq   and   f.Prod_code=e.PROD_CODE)g,t_task_fini   h   where   h.seqn_num=g.seqn_num  


====================================================================
看来等晚上经理开列会的时候跟他说,我没那个能力```哎```来公司一年多``第一次说不行`````

[解决办法]
sf
[解决办法]
sf
[解决办法]
1
[解决办法]
起码加注释吧~~

比加密还厉害.
[解决办法]
jf
[解决办法]
暈!
[解决办法]
花了
[解决办法]
然後暈了
[解决办法]
啊!
我写的比他还长。
回去加注释去!

[解决办法]
看出来了,不是sql server的

[解决办法]
jf
[解决办法]
轻松多了 ,好笑。
[解决办法]
其实弄好格式就清楚了,注释倒不是最重要的。
[解决办法]
看这代码叫人家怎么轻松啊?  赶快多给点分补偿一下。
[解决办法]
闭着眼睛看一下
[解决办法]
看这代码叫人家怎么轻松啊?  赶快多给点分补偿一下。

[解决办法]
传说中的牛人。。。。

[解决办法]
那我不客气咯 哈哈
[解决办法]
注意缩进
自己整理一下看起来就不一样了

[解决办法]
create or replace view elappadm.v_empl_money asselect Pay_type,employees_id,class_id,money,Month from(
SELECT '0 ' Pay_type,
a.employees_id,
a.class_id,
decode(c.Fixed, 1, decode(a.money * decode(d.native_wb, 1, Total_coefficient
* b.Personal_rate, b.total_wrate * b.personal_wrate), NULL, a.money, a.money
* decode(d.native_wb, 1, Total_coefficient * b.Personal_rate, b.total_wrate
* b.personal_wrate)), - decode(a.money * decode(d.native_wb, 1,
Total_coefficient * b.Personal_rate, b.total_wrate * b.personal_wrate), NULL
, a.money, a.money * decode(d.native_wb, 1, Total_coefficient * b.Personal_rate
, b.total_wrate * b.personal_wrate)))AS money,
' ' AS MONTH
FROM t_al_welfare a, T_Insurance_class b, v_xcfl_class c, t_employees dwhere a
.class_id=b.Class_Id(+)and a.class_id not in( 'A-01 ', 'A-02 ', 'A-03 ', 'A-04 ', 'A-05 ')and (a.class_id=c.Class_Id or b.class_id=c.Class_Id) and d.employees_id=a.employees_idunionselect pay_type,employees_id,class_id,-sum(money) as money,month from (
SELECT '1 ' Pay_type,
employees_id,
'A-03 ' class_id,
Punish_money money,
Kq_Month AS monthfrom
T_Kq_hz) group by pay_type,employees_id,class_id,monthunionselect '0 ' Pay_type,Employees_id, 'A-01 ' Class_id,Pay_money as money, ' ' as month from T_Employees a,T_Pay_class b


where a.PAY_ID=b.PayClass_idunionselect '1 ' Pay_type,q.employees_id, 'A-02 ' as Class_id,q.money*decode(w.bonus_rate,null,1,w.bonus_rate) money,q.month from (
SELECT m.employees_id,
m.money,
m.month,
n.deptid AS tdeptid
FROM v_bonus_money m, t_employees nwhere n
.employees_id=m.employees_id ) q,T_Bonus_rate w
where w.ydate(+)=q.month and w.deptid(+)=q.tdeptid union
SELECT '0 ' Pay_type,
b.employees_id,
'A-05 ' Class_id,
(b.Work_years * a.SUBVENTION_JE)AS money,
' 'AS MONTH
FROM T_Employ_Class a, t_employees b
WHERE b.Emp_classID = a.emp_classid
AND b.work_years <= a.max_year
)unionselect '1 ' Pay_type,g.work_num as employees_id, 'A-04 ',g.price*h.fini_num as money,to_char(h.writ_time, 'yyyymm ') as month from (
select f.PRICE,e.seqn_num,e.Work_num from t_prod_proc f,(select m.seqn_num,m.Bill_id,m.Proc_id,m.seq,m.Work_num,n.PROD_CODE from T_task_dist m,(select b.PROD_CODE,a.bill_id from t_prod_info a,v_t_bom_base b where a.bom_id=b.bom_id) n where m.bill_id=n.bill_id and m.dist_type= '1 'unionselect c.seqn_num,c.Bill_id,c.Proc_id,c.seq,d.g_manger as work_num,c.PROD_CODE from (
SELECT m.seqn_num,
m.Bill_id,
m.Proc_id,
m.seq,
m.Work_num,
n.PROD_CODE
FROM T_task_dist m, (
SELECT b.PROD_CODE,
a.bill_id
FROM t_prod_info a, v_t_bom_base b
WHERE a.bom_id = b.bom_id) n
WHERE m.bill_id = n.bill_id
AND m.dist_type = '2 '
)c,t_group d
where c.Work_num=d.group_id)ewhere f.Proc_id=e.Proc_id and f.seq=e.seq and f.Prod_code=e.PROD_CODE)g,t_task_fini h
where h.seqn_num=g.seqn_num

热点排行