SELECT * from co_admin where userid in(1,102,103,76,90,44);
//上面的结果查询出来的数据是按照id的大小升序排的,并不是我们要的结果
//所以我们需要用到自定义排序
select * from co_admin where userid in(1,102,103,76,90,44)
order by case userid when 1 then 1
when 102 then 2
when 103 then 3
when 76 then 4
when 90 then 5
when 44 then 6
end
//
SELECT p.*,c.countryid,c.uk_email,c.au_email
FROM `tcacos`.`co_pay_account` p
LEFT JOIN co_cacos c ON
IF(p.ccid > 0, c.ccid = p.ccid, c.userid = p.userid)
WHERE p.depositid > 3 ORDER BY p.paytime DESC,p.id DESC
//原来IF还可以这样用
PHP Mysql or条件排序问题
最新推荐文章于 2022-10-13 13:00:21 发布