我想把每种产品中的子产品(id)放在优先地位。
Product_id | Sub_product | Category |
---|---|---|
10101010 | 02020202 | Superior |
10101010 | 02020204 | High-valued |
0120202 | 0930303 | High-valued |
0120202 | 039303 | VALUE |
0303303 | 039302929 | VALUE |
0303303 | 0393342929 | AddOn |
预期结果如下:
Product_id | Sub_product | Category | Priority |
---|---|---|---|
10101010 | 02020202 | Superior | 1 |
10101010 | 02020204 | High-valued | 2 |
0120202 | 0930303 | High-valued | 1 |
0120202 | 039303 | VALUE | 2 |
0303303 | 039302929 | VALUE | 1 |
0303303 | 0393342929 | AddOn | 2 |
www.un.org/spanish/ecosoc 优先秩序:
Superior = 1
High-valued = 2
VALUE = 3
AddOn = 4
利用衍生栏,我可以实现以下产出。
Product_id | Sub_product | Category | Priority |
---|---|---|---|
10101010 | 02020202 | Superior | 1 |
10101010 | 02020204 | High-valued | 2 |
0120202 | 0930303 | High-valued | 2 |
0120202 | 039303 | VALUE | 3 |
0303303 | 039302929 | VALUE | 3 |
0303303 | 0393342929 | AddOn | 4 |
是否有可能从每件产品1个开始?