Php 具有多个参数的SQL按大小写顺序
我想这样排列我的结果:Php 具有多个参数的SQL按大小写顺序,php,mysql,sql,mysqli,Php,Mysql,Sql,Mysqli,我想这样排列我的结果: $query_resultat .= "ORDER BY case when vendue = 'AV' then 1 when vendue = 'VPNA' then 2 when vendue = 'EC' then 3 when vendue = 'V' then 4 when vendue = 'SCDV' then 5 else 6 end"; 但我想问的是,是否有可能添加另一个类似的条件:当vendue='AV'时,首先订购结果,然后按Id DESC订购此
$query_resultat .= "ORDER BY case
when vendue = 'AV' then 1
when vendue = 'VPNA' then 2
when vendue = 'EC' then 3
when vendue = 'V' then 4
when vendue = 'SCDV' then 5
else 6 end";
但我想问的是,是否有可能添加另一个类似的条件:当vendue='AV'时,首先订购结果
,然后按Id DESC订购此结果
第二次,当vendue='VPNA'
时,订购结果,并按ID DESC订购此结果
可以这样做吗?如果您希望在其他条件下按ID订购项目,您可以将其添加到order by子句的末尾
$query_resultat .= "ORDER BY case
when vendue = 'AV' then 1
when vendue = 'VPNA' then 2
when vendue = 'EC' then 3
when vendue = 'V' then 4
when vendue = 'SCDV' then 5
else 6
end,
ID DESC";
很简单,谢谢!