我想首先获得所有具体位置的配置文件: 8 X0 `% T8 |. c8 v' ]# QSELECT * FROM profileWHERE location IN ('a','b','c') OR isDefault=1 ORDER BY location IN ('a','b') DESC,-- put to the front if location in 'a','b isDefault DESC, -- for each of both groups,put default profiles before the others. location ASC -- and sort each of the up to four groups by location.这将导致错误:关键词’IN’附近的语法不正确。。如果删除order子句,则返回结果。: n0 |% \8 N' E
这是怎么了2 q3 Y8 Y+ B5 g: N0 l
$ x& O' n* o; c2 W' b! a" w 解决方案: 2 R: c7 Z0 L# o! ^0 X4 b 您可以重写该值以返回可排序的整数:+ S; e3 z" \& H5 `, c I' I* R
case when location IN ('a','b') then 0 else 1 end DESC