php - Can't retrieve zero values when using COUNT and GROUP together -
i'm struggling mysql query, when using count , group it's excluding rows have count of 0. understand why happening can't work out how around it. i've read on potential solutions presented similar problem cannot see link between 2 allow me solve it.
can help?
$query = "select id, class_date, class_id, count(*) reserve_count bookings booking_status='#reserve#' group class_date, class_id order class_date asc, class_id asc" ; $result = mysqli_query($sql,$query); while($row = mysqli_fetch_assoc($result)) { $bookings[$row['id']] = array('class_date' => $row['class_date'], 'class_id' => $row['class_id'], 'reserve_count' => $row['reserve_count']); }
logically, there shouldn't row 0 count because booking table should have classes booked.
Comments
Post a Comment