标题: 请问这个sql语句是什么意思 [打印本页] 作者: 小果妙 时间: 2016-7-22 12:04 标题: 请问这个sql语句是什么意思 select count(*) from sys_base sb where sysbase_tag = 'AQ'
and sb.sysbase_id in (
select y.syscorp_district from
(
select x.*
from (select to1.*,
ROW_NUMBER() OVER(PARTITION BY to1.t_user_id, to1.t_disaster_id ORDER BY back_time desc) as myrowid,
td1.tname,
tu.syscorp_id ,
sc.syscorp_district
from t_order to1
left join t_disaster td1 on td1.t_disaster_id =
to1.t_disaster_id
left join t_user tu on tu.t_user_id = to1.t_user_id
left join sys_corp sc on sc.syscorp_id = tu.syscorp_id
where 1 = 1
and back_time is not null
and (to1.t_task_id = 2 or to1.t_task_id = 0)) x
where x.myrowid = 1 -- and back_disaster_id = 104