视图和存储过程都是事先在数据库中创建好的,项目中需要查询数据的时候 直接执行
select * from myView 即可
CREATE VIEW myView AS
select
tss.channel_id as channelId,
tssr.risk_id as riskId,
count(tssr.risk_id) as riskCount
from t_slaq_salesman_20191225 tss
JOIN t_slaq_salesman_risk_20191225 tssr
on tssr.salesman_id = tss.salesman_id
WHERE
instr(organization_id,'86')
group by tss.channel_id,tssr.risk_id
order by tss.channel_id,count(tssr.risk_id) DESC
select * from myView
DROP VIEW myView