Home  >  Article  >  Backend Development  >  php关于查询排序的有关问题

php关于查询排序的有关问题

WBOY
WBOYOriginal
2016-06-13 10:57:201002browse

php关于查询排序的问题
目前我遇到一个问题关于查询结果的排序

首先是A表查询出了一批产品详细信息结果
但是需要对这批结果需要再进行一次排序,而排序的依据在B表内

条件是,如果A表中的产品ID存在于B表中的字段中(字段形式是A表产品ID的集合: 355,223,367)
如果ID为355,223,367的产品存在于B表的字段中,那么这三个产品就排在最前面

请问,有什么方式能实现这种效果吗?或者是对查询出的数组进行排序操作也可以,希望提供点思路

------解决方案--------------------
用left join order by B里的A产品的ID

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn