我想显示2行5,但我似乎无法想到背后的逻辑。感谢帮助。
$sql = " SELECT KEYWORD, COUNT(*) Count_Duplicate
FROM {$_POST['btn']}
GROUP BY KEYWORD
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
LIMIT 10";
这是我的SQL查询部分,我就像这样回应它,
echo $row['KEYWORD'] .", " ." " ;
答案 0 :(得分:1)
您可以使用带偏移值的限制,它也可以帮助您进行延迟加载。 限制可以通过这种方式改变。
$sql = " SELECT KEYWORD, COUNT(*) Count_Duplicate
FROM {$_POST['btn']} GROUP BY KEYWORD HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC LIMIT 2,OFFSET 10";
Offset显示将选择行的索引,您可以忽略OFFSET使用限制为LIMIT 2,10;仅
答案 1 :(得分:1)
试试这段代码。
$sql = " SELECT KEYWORD, COUNT(*) as Count_Duplicate FROM {$_POST['btn']} GROUP BY KEYWORD
HAVING COUNT(*) > 1 ORDER BY COUNT(*) DESC LIMIT 2";
使用循环显示结果