test1.txt
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
select * from jwgl_f_t_clxh_workflow_detail a where a.ID_LYSYLB = 36;
select sum(amount - tl_amount) from jwgl_f_t_clxh_workflow_detail
where
to_date(statdateid, 'YYYYMMDD') >= to_date('20170301', 'YYYYMMDD')
and to_date(statdateid, 'YYYYMMDD') <= to_date('20170331', 'YYYYMMDD')
select * from JWGL_D_T_LYSYLB
-- all xh
select
statdateid statdate
, ssjc gs
, xl xl
, zbh cl
, b.SYLB1 || '-' || b.SYLB2 as lylb
, (sum(amount) - sum(tl_amount)) ch
from JWGL_F_T_CLXH_WORKFLOW_DETAIL a, JWGL_D_T_LYSYLB b
where
to_date(statdateid, 'YYYYMMDD') >= to_date('20170301', 'YYYYMMDD')
and to_date(statdateid, 'YYYYMMDD') <= to_date('20170331', 'YYYYMMDD')
and a.ID_LYSYLB = b.ID(+)
group by
statdateid
, ssjc
, xl
, zbh
, b.SYLB1 || '-' || b.SYLB2
-- part1
select sum(ch) from
(
select
statdateid statdate
, ssjc gs
, xl xl
, zbh cl
, b.SYLB1 || '-' || b.SYLB2 as lylb
, (sum(amount) - sum(tl_amount)) ch
from JWGL_F_T_CLXH_WORKFLOW_DETAIL a, JWGL_D_T_LYSYLB b
where
to_date(statdateid, 'YYYYMMDD') >= to_date('20170301', 'YYYYMMDD')
and to_date(statdateid, 'YYYYMMDD') <= to_date('20170331', 'YYYYMMDD')
and a.ID_LYSYLB = b.ID(+)
group by
statdateid
, ssjc
, xl
, zbh
, b.SYLB1 || '-' || b.SYLB2
)
where lylb in (
'路救-路救',
'小修-小修机工',
'专项-安检',
'专项-节检',
'专项-水箱',
'专项-电瓶',
'小修-小修电工',
'专项-电并',
'小修-小修车身',
'专项-镗固',
'保养-一级保养',
'小修-发动机',
'专项-轮胎',
'分摊-轮胎',
'专项-润滑油',
'总成-差变速',
'总成-大泵',
'总成-小总成',
'总成-发动机',
'保养-二级保养',
'保养-三级保养',
'整修-整修',
'空调-保外',
'空调-保内',
'事故-事故'
)
-- part2
select sum(ch) from
(
select
statdateid statdate
, ssjc gs
, xl xl
, zbh cl
, b.SYLB1 || '-' || b.SYLB2 as lylb
, (sum(amount) - sum(tl_amount)) ch
from JWGL_F_T_CLXH_WORKFLOW_DETAIL a, JWGL_D_T_LYSYLB b
where
to_date(statdateid, 'YYYYMMDD') >= to_date('20170301', 'YYYYMMDD')
and to_date(statdateid, 'YYYYMMDD') <= to_date('20170331', 'YYYYMMDD')
and a.ID_LYSYLB = b.ID(+)
group by
statdateid
, ssjc
, xl
, zbh
, b.SYLB1 || '-' || b.SYLB2
)
where lylb in(
'分摊-镗固',
'专项-机油',
'分摊-机油',
'总成-其它',
'分摊-工具',
'分摊-辅助料',
'分摊-设备',
'车间经费-车间经费'
)