Mysql排序结果而不排除其他结果
我有一个按国家列出的本地化结果列表。我首先想得到有效国家X的结果,然后是相同国家的其他结果。可能吗 如果我设置一个where“anno_country”=1。。。它排除了其他国家的结果。我想要“按国家订购=3”之类的东西 目前,这是我的MySQL查询:Mysql排序结果而不排除其他结果,mysql,sql-order-by,Mysql,Sql Order By,我有一个按国家列出的本地化结果列表。我首先想得到有效国家X的结果,然后是相同国家的其他结果。可能吗 如果我设置一个where“anno_country”=1。。。它排除了其他国家的结果。我想要“按国家订购=3”之类的东西 目前,这是我的MySQL查询: SELECT DISTINCT * FROM (`annonce`) JOIN possede USING (`anno_id`) JOIN annonceur USING (`ann_id`) JOIN lang_pays USING
SELECT DISTINCT *
FROM (`annonce`)
JOIN possede USING (`anno_id`)
JOIN annonceur USING (`ann_id`)
JOIN lang_pays USING (`pays_id`)
JOIN cat_lang USING (`cat_id`)
WHERE
`cat_id` IN ('4', '9', '5', '426', '6', '435', '7', '3', '8', '2')
AND
`anno_active` = 1
AND
`anno_mode` = 1
AND
`cat_lang`.`lang_id` = '3'
AND
`lang_pays`.`lang_id` = '3'
ORDER BY `anno_id` desc
你有什么想法吗?你可以用这个:
ORDER BY (country != 3), anno_id DESC
这将在顶部显示country=3的行,按anno_id desc排序,然后显示country的所有行=3在底部,由anno_id desc订购
从您的表格中选择*订购人(
国家=“X”)说明,
国家
这将先按国家x订购,然后再按其他国家/地区订购