怎么取根据products_id为6取它的上一条记录。
怎么取根据products_id为6取它的上一条记录。
注意不能用products_id<6 limit 1条件,因为products_id是大小随机排列
------解决方案--------------------select * from tt where products_id<6 order by products_id desc limit 1
------解决方案--------------------select * from tt where price.products_id<6 and price.price='100' order by price.products_id desc limit 1 ,试试