MySQL-将列值从一行交换到另一行

时间:2019-10-21 18:32:13

标签: mysql interchange

SELECT OlineDate, OlineOrder, OlineDesc, OlineGroup, OlinePrice
FROM tblorderlines
WHERE DATE(OlineDate) = '2019-10-19' AND OlineOrder = 170
AND OlineGroup IN ('spec')

|====================================================================|
| OlineOrder |OlineDate   | OlineDesc | OlineGroup     | OlinePrice  |
|============+============+===========+================+=============|
| 10         | 2019-10-19 | Coupon    |    spec        |   -2.42     |
|------------+------------+-----------+----------------|-------------|
| 10         | 2019-10-19 | 10% OFF   |    spec        |    0.00     |
|------------+------------------------+----------------+-------------|

我正在寻找一个查询,该查询会将'10%off'的值替换为'Coupon'的值。我发现可能会产生我想要的结果的唯一结果是数据透视表,但是这些在MySQL中不存在。我还能走另一条路线吗?

0 个答案:

没有答案