Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize | SQLize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $connection = &$mysqli; $sql = mysqli_query($connection, " SELECT Entity_Name, Count(*) Count_All, Count(NULLIF(Plan_Name, 'Complementary_Package')) Not_Complementary_Package FROM mq_active_sep21 GROUP BY Entity_Name ORDER BY Entity_Name; "); while($row = mysqli_fetch_assoc($sql)) { printf( "Entity_Name: %s, Total: %d, Complementary_Package: %d " . PHP_EOL, $row['Entity_Name'], $row['Count_All'], $row['Count_All'] - $row['Not_Complementary_Package'] ); }
Copy Clear