Home > Backend Development > PHP Tutorial > mysql表多列排序,得到某个指定值的上一条或下一条,如何做简单点

mysql表多列排序,得到某个指定值的上一条或下一条,如何做简单点

WBOY
Release: 2016-06-13 12:30:08
Original
1381 people have browsed it

mysql表多列排序,得到某个指定值的上一条或下一条,怎么做简单点
一个进销存数据库mysql,表名tblsale,有date和index两个字段来确定一个销售单(一天里面有n单,用index来区分),表里面的记录并不一定是按顺序排放,因为存在后面补加的可能。
单纯的对表里的记录进行排序,可以用order by date, index来排(视情况用升序或降序)。
现在前端传过来一个date和一个index,根据这个特定的date和index来找出它的上一单或者下一单。在PHP里,怎么做简单点呢?

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template