我有一个关于根据列值拆分行的问题
我的示例数据集是:
id, ExpenseType, Price
1, Car, 100
2, Hotel, 50
我想将那些具有某些费用类型(例如Car)的行拆分为两行。其他应保留为一行。
First row Price *70
Second Row Price *30
返回的数据集应为
id, ExpenseType, Price
1, Car, 70
1, Car, 30
2, Hotel, 50
感谢您提前回答
一种简单的方法使用union all
: