我这里有一些代码从db获取第n行。问题是它有时会跳过一行或几行或只是错过它。 f_id
设置为自动递增,没有间隙。无论它不应该跳过任何f_id,做错了什么?
$sql2 = mysql_query("SELECT *
FROM (
SELECT
@row := @row +1 AS rownum, price,f_id, car, color
FROM (
SELECT @row :=0) r, $tbName WHERE (car= '$car') $color $location AND (price BETWEEN '".$min."' AND '".$max."')
) ranked
WHERE rownum %25 =1 order by price ASC, f_id ASC");
我注意到WHERE
部分在使用OR
exp AND (color = 'green' OR color = 'red')
时无效,但它有时会跳过红色。有什么想法吗?