简体   繁体   English

整个结果中的SQL One值移到顶部

[英]SQL One value from whole result move to the top

How despite of GROUP, ORDER and another parameters move one of select result rows to the top? 尽管有GROUP,ORDER和其他参数,如何将选择结果行之一移到顶部? For example there on SqlFiddle 例如在SqlFiddle上

Move row 3, with type Loren, to the top ? 将第3行(类型为Loren)移到顶部?

select id, type, details from dummyTable order by type="Lorem" DESC

Sql Fiddle URL

Answer is 答案是

select id, type, details from dummyTable ORDER BY IF(type = 'Test', 0, 1), id LIMIT 0, 5

SqlFiddle example SqlFiddle示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM