I am pondering if there is away that I can count different values from different columns using one SQL Query.
I am making Graphs on my website and I want it to count No values in rows I was thinking to use the following
$sql="SELECT incident.ppe, incident.induction, incident.actions, incident.ssops
FROM incident WHERE ppe = 'No' OR induction = 'No' OR actions = 'No' OR ssops = 'No'
AND YEAR(date) = YEAR(CURDATE())
AND client_id = '$slcustom1'"
The values are Yes and No Values. What my aim is is to echo the value of each Column in the graph values I am using.
var data = google.visualization.arrayToDataTable([
['', ''],
['PPE', 11], // Value 11 should be row counts of all the No's same with all values below
['Induction', 2],
['Actions', 2],
['SSOPs', 2]
Currently I do a SQL query for each value but this is making my code very long and untidy. Any suggestions would be appreciated. Group by will also work but how do I echo each result to the Graph value