多sql查询count合并为一行
with temp1 as (
select count(*) as riskNum from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/>
),
temp2 as (
select count(*) as todayNew from dsc.dsc_risk_event
<include refid="Where_Clause"/>
),
temp3 as (
select count(*) as noDeal from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> and status in ('0', '1')
),
temp4 as (
select count(*) as deal from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> and status in ('2', '-1')
),
temp5 as (
select count(*) as low from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> and riskLevel = '1'
),
temp6 as (
select count(*) as medium from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> and riskLevel = '2'
),
temp7 as (
select count(*) as high from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> and riskLevel = '3'
),
temp8 as (
select eventTime as warnTime from dsc.dsc_risk_event
<include refid="Where_Clause_Assets"/> order by eventTime desc limit 1
)
select riskNum, todayNew, noDeal, deal, low, medium, high, warnTime
from temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8