Good morning, I have a small query ... I have this table in Mysql
This is my query:
SELECT at_ce.condicion,
COUNT(at_ce.id) AS cantidad_condicion,
gpr.grupo_programa,
COUNT(gpr.id_programa) AS cantidad_grupo_programa
What I need is to count all the "RESERVED", "CONFIRMED", "I DO NOT PASS CONSULTATIONS" and in group program "HEALTH CLUB" "INSTITUTIONAL / PRIVATE" "CIA INSURANCE / CONVENTIONS".
Something like that
$ Reserved = Quantity_reserved; $ Queries = number_consults; ...
I wanted to do it first with a FOR and then a switch something like that
$c = count($resultado);
for($i = 0, $i < $c; $i++){
switch($resultado[$i]->GRUPO2){
case 'CONDICION':
switch($resultado[$i]->GRUPO1){
case('RESERVADO'): SUMA DE TODOS LOS RESERVADOS;
break;
};
break;
case 'GRUPO_PROGRAMA':
switch($resultado[$i]->GRUPO1){
case('CLUB DE LA SALUD'): SUMA DE TODOS LOS CLUB DE LA SALUD;
break;
};
break;
}
}
The SQL query I do is the following:
SELECT at_ce.condicion, COUNT(at_ce.id) AS cantidad_condicion, gpr.grupo_programa, COUNT(gpr.id_programa) AS cantidad_grupo_programa
But I know how to set its variables, someone could please guide me. Thank you very much in advance.