我正在构建一个根据一组 ORDER BY 指令提取值的查询
SELECT * from values ORDER BY displayOrder, actualValue, field(key, 'A', 'B', 'C')
所以这可能会返回:
name productType displayOrder actualValue key
object_a X 1 1.2 A
object_b Z 1 1.2 C
object_c Z 1 1.6 B
object_d X 1 1.8 B
但是,如果 productType = Z,我想切换 ORDER BY actualValue 和 field(key) 以生成以下内容:
name productType displayOrder actualValue key
object_a X 1 1.2 A
object_c Z 1 1.6 B
object_b Z 1 1.2 C
object_d X 1 1.8 B
这有可能吗?