I Have a Table with 2 items in that 1 item has 3 quantity and other item have 2 i need to get it like for item 1-1,2,3(3quantity) and item 2-1,2(2quantity)
我有一个表有2个项目,1个项目有3个数量,其他项目有2我需要得到它像项目1-1,2,3(3quantity)和项目2-1,2(2quantity)
ItemName Quantity TagNo
Cap 3 1
Cap 3 2
Cap 3 3
Shirt 2 1
Shirt 2 2
2 个解决方案
#1
0
Please try
请尝试
SELECT itemname
,quantity
,row_number() OVER (
PARTITION BY itemname ORDER BY itemname
)
FROM < table_name >;
#2
#1
0
Please try
请尝试
SELECT itemname
,quantity
,row_number() OVER (
PARTITION BY itemname ORDER BY itemname
)
FROM < table_name >;