select tbl3.* from
(
select BusinessType,BusinessID,max from
(select BusinessType,BusinessID,Max(EventID) max,Min(EventID) min from ChangeLogForSync
where IsUpload=0
group by BusinessID,BusinessType) tbl1
where not ((select OperateType from ChangeLogForSync where EventID=tbl1.max)=3 and
(select OperateType from ChangeLogForSync where EventID=tbl1.min)=1)
) tbl2,ChangeLogForSync tbl3 where tbl2.max=tbl3.EventID这个里面 where not 是什么意思. 组合起来是什么意思
(
select BusinessType,BusinessID,max from
(select BusinessType,BusinessID,Max(EventID) max,Min(EventID) min from ChangeLogForSync
where IsUpload=0
group by BusinessID,BusinessType) tbl1
where not ((select OperateType from ChangeLogForSync where EventID=tbl1.max)=3 and
(select OperateType from ChangeLogForSync where EventID=tbl1.min)=1)
) tbl2,ChangeLogForSync tbl3 where tbl2.max=tbl3.EventID这个里面 where not 是什么意思. 组合起来是什么意思
not exists 不存在
或者 (select OperateType from ChangeLogForSync where EventID=tbl1.min)=1 不成立就是 OperateType <>3 或者 <>1 的意思 --这个sql写的太诡异
(select OperateType from ChangeLogForSync where EventID=tbl1.min)=1)
就是看这个语句是真还是假
not 取反