|
@@ -545,6 +545,7 @@ t107 as (
|
|
|
t111 as (
|
|
|
select
|
|
|
case
|
|
|
+ when (select not exists(select 1 from car.car_base_data_month b where b.che_pai_hao = a.che_pai_hao and b.year_month = a.stat_year_month)) then 0
|
|
|
when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month)) then 0
|
|
|
when first_unit = '省公司本部' then 0
|
|
|
when position('建设部' in che_liang_suo_shu_dan_wei) > 0 then 0
|
|
@@ -557,6 +558,7 @@ select
|
|
|
else 0
|
|
|
end as di_xiao_sum,
|
|
|
case
|
|
|
+ when (select not exists(select 1 from car.car_base_data_month b where b.che_pai_hao = a.che_pai_hao and b.year_month = a.stat_year_month)) then '当月车辆基本信息不存在'
|
|
|
when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month and b.valid = 1)) then (select max(b.year_month) from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month) || '报废'
|
|
|
when first_unit = '省公司本部' then '省公司本部'
|
|
|
when position('建设部' in che_liang_suo_shu_dan_wei) > 0 then '建设部'
|