Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 具有多个参数的SQL按大小写顺序_Php_Mysql_Sql_Mysqli - Fatal编程技术网

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";

很简单,谢谢!