sql求优化
select Min(datacode)
from(
select datacode from data where type='0'
)a
where
LEN(datacode)=(select max(len(datacode))from (
select datacode from data where type='0'
)a)
以上这句需求是从目标表获取列datacoe中值的长度最大的值中的最小值
例如从1 2 32 9 71 123 567 234获取123
我这样写执行效率很低,要进行2次聚集索引扫描。
请优化一下
...全文


疑难问题

