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

时间:2014-11-27 14:43:22

标签: php mysql arrays

尽管GROUP,ORDER和其他参数如何将一个选择结果行移到顶部? 例如SqlFiddle

将第3行(类型为Loren)移至顶部?

2 个答案:

答案 0 :(得分:1)

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

Sql Fiddle URL

答案 1 :(得分:1)

答案是

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

SqlFiddle example