select top 25 A.*, isNull(B.D01,'') as D01 from C1 A left join D1 B on A.C00=B.D00 where 1=1
and C00 not in(select D00 from D2)
and C01 like '%111%'
order by c01 asc
上面的能查出数据结果,时间不到1秒但同时也要查询出记录的条数,下面这个要10秒,不知哪位能优化一下,太慢了select count(*) from c1 where 1=1
and C00 not in(select D00 from D2)
and C01 like '%111%'
and C00 not in(select D00 from D2)
and C01 like '%111%'
order by c01 asc
上面的能查出数据结果,时间不到1秒但同时也要查询出记录的条数,下面这个要10秒,不知哪位能优化一下,太慢了select count(*) from c1 where 1=1
and C00 not in(select D00 from D2)
and C01 like '%111%'
and not exists(select 1 from d2 where doo=a.coo)
and charindex('111',co1)>0
from c1
where 1=1
and C00 not exists (select 1 from D2 where D2.D00 = c1.C00)
and C01 like '%111%'
如果条件如此就没办法了