select (SELECT count(1)FROM entity.PhysicalItemResult sub,entity.PhysicalItemResult main
WHERE sub.physicalitemid = main.physicalitemid AND sub.physicalitemresultid <= main.physicalitemresultid
) as '序号',physicalitemid,physicalitemresultid
from entity.PhysicalItemResult
-------------------------------
SELECT(SELECT COUNT(1) FROM entity.PhysicalItemResult sub WHERE sub.physicalitemid = main.physicalitemid
AND sub.physicalitemresultid <= main.physicalitemresultid) AS 序号,physicalitemid,physicalitemresultid
FROM entity.PhysicalItemResult main
为什么第二次数据是这样?内嵌,
每一对main的physicalitemid,physicalitemresultid就对应一次嵌套查询(循环嵌套?)