我想在MySQL中创建数据包。 每个小包应包含3件T恤:一件红色和2件非红色T恤。
我的表格如下:
ID, product, packet_number
1, red t-shirt,
2, red t-shirt,
3, blue t-shirt,
4, green t-shirt,
5, blue t-shirt,
6, blue t-shirt,
7, blue t-shirt,
8, green t-shirt,
9, red t-shirt,
我想得到什么:
ID, product, packet_number
1, red t-shirt,#1
2, red t-shirt,#2
3, blue t-shirt,#1
4, green t-shirt,#1
5, blue t-shirt,#2
6, blue t-shirt,#2
7, blue t-shirt,#3
8, green t-shirt,#3
9, red t-shirt,#3
有什么想法吗?