日期:2014-05-18 浏览次数:20509 次
select * ,(select count(1) from tb where 票号=t.票号 and 产品编号<t.产品编号) from tb t
------解决方案--------------------
SELECT *,(SELECT COUNT(1) FROM TB WHERE 票号=T.票号 AND 产品编号>=T.产品编号) AS RN
FROM TB T
------解决方案--------------------
[color=#FF0000][/color]SELECT *,(SELECT COUNT(1) FROM TB WHERE 票号=T.票号 AND 产品编号<=T.产品编号) AS RN
FROM TB T
------解决方案--------------------