视图和存储过程都是事先在数据库中创建好的,项目中需要查询数据的时候 直接执行
select * from myView 即可
CREATE VIEW myView AS selecttss.channel_id as channelId,tssr.risk_id as riskId,count(tssr.risk_id) as riskCountfrom t_slaq_salesman_1225 tss JOIN t_slaq_salesman_risk_1225 tssron tssr.salesman_id = tss.salesman_idWHEREinstr(organization_id,'86')group by tss.channel_id,tssr.risk_idorder by tss.channel_id,count(tssr.risk_id) DESCselect * from myViewDROP VIEW myView