我想把所有的条目都和我的身份证核对一下
我使用了这个查询
select count(*) from table1 group by `id`
问题是我的表有3条记录
id A has 2 records
id B has 1 record
当我用php运行这个查询时,它给了我2个entries
$mysqli = new mysqli("localhost","root", "", "db");
$query = $mysqli->prepare("SELECT COUNT(*) FROM `tble1` GROUP by `ID`");
$query->execute();
$query->store_result();
$rowsaff = $query->num_rows;
echo $rowsaff;
1条答案
按热度按时间fcg9iug31#
编辑:误解了问题。
必须选择不同id的计数: