一条sql语句 select count(*) from bureau_info f where f.bur_id in(select distinct bur_id from ( select a.bur_id ,a.nonce_state from bureau_state a left join (select bur_id , max(sta_begin_date)maxDate from bureau_state group by bur_id )t on a.bur_id = t.bur_id where a.sta_begin_date = t.maxDate)where nonce_state = '预警') and f.bur_line='2' and bur_state != '6'sql语句 select c.bur_project_name, c.bur_editer, d.nonce_state from ( select a.bur_id, a.nonce_state from bureau_state a left join (select bur_id, max(sta_begin_date) maxDate from bureau_state group by bur_id) b on a.bur_id = b.bur_id where a.sta_begin_date = b.maxDate and a.nonce_state in ('预警', '高危') )d left join bureau_info c on c.bur_id = d.bur_id where c.bur_state != '6' and c.bur_project_name is not null
详细解决方案
sql 话语
热度:221 发布时间:2016-05-05 15:23:22.0
相关解决方案