SQL, select后的表,希望增加一下自动排序号的列
正在学习ASP+SQL
SQL, select出来的表,希望增加一下自动排序号的列:
select
增加一个字段,字段名是“序号”,生成的表中,序号从1开始自动排列,
A.WeiKaiPiao,A.KeKaiPiao,A.DanJia,A.BeiZhu,A.YueFen,
B.VendorCode as VendorCode,
C.cvenname as cvenname,
L.GoodsCode as GoodsCode,
M.Goodsname as Goodsname,
N.goodsstd as goodsstd,
O.goodsm_unit as goodsm_unit
FROM GongYinShangKaiPiao A
LEFT JOIN ba_vendor_all B ON A.vendorid=B.vendorid
LEFT JOIN ba_vendor_all C ON A.vendorid=C.vendorid
LEFT JOIN ba_goods_all L ON A.goodsid=L.goodsid
LEFT JOIN ba_goods_all M ON A.goodsid=M.goodsid
LEFT JOIN ba_goods_all N ON A.goodsid=N.goodsid
LEFT JOIN ba_goods_all O ON A.goodsid=O.goodsid
WHERE A.GuanBi=0
order by B.VendorCode,L.GoodsCode
上述红色部分,弄不出来了,请老师帮忙,谢谢了。
------解决方案--------------------select partition_date , rownum rn from fct_portal_collect_min t 这个序号是你需要的么
------解决方案--------------------SELECT ROW_NUMBER() AS ROW, * FROM Table
如果有排序的话最好加排序
SELECT ROW_NUMBER() OVER (ORDER BY ID DESC) AS ROW, * FROM Table