这是我桌子的插图。
id | stocks | colour
0156 | in | red
5482 | out | red
5488 | out | yellow
我需要获得3行计数。如何在查询中使用3种不同类型的COUNT值?
$sql="SELECT count(*) FROM tbl,
(SELECT count(*) FROM tbl WHERE stock = 'out'),
(SELECT count(*) FROM tbl WHERE colour= 'yellow')";
$statement = $connect->prepare($sql);
$statement->execute();
$row = $statement->fetch(PDO::FETCH_NUM);
$val_tot = $row[0]; //?