存储过程中,查询语句结果集中某个字段从1开始加1
SELECT ID, ORDERID1, CUSTOMERCODE, CUSTOMERNAME, PRODUCTCODE, PRODUCTNAME, BARQUANTITY,PickDate,ORDERID FROM V_INTERFACE WHERE PickDate='''+@strPickDate+''' and BorrowID1 in ('+Rtrim(@strPickNo)+'''-1'') ORDER BY PRODUCTCODE ,ORDERID ASC
ID 从1开始加1
V_INTERFACE 是视图
求大侠帮忙呀...
------解决方案--------------------你是要行号吗,还是要把ID修改为行号啊?
------解决方案--------------------SELECT row_number() over(order by getdate()) as ID, ORDERID1, CUSTOMERCODE, CUSTOMERNAME, PRODUCTCODE, PRODUCTNAME, BARQUANTITY,PickDate,ORDERID FROM V_INTERFACE WHERE PickDate='''+@strPickDate+''' and BorrowID1 in ('+Rtrim(@strPickNo)+'''-1'') ORDER BY PRODUCTCODE ,ORDERID ASC