$sql="SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name." GROUP BY year, month, sourceIdp HAVING sourceIdp != ''";
$result=$conn->query($sql);
$stmt=$conn->prepare("SELECT year, month, sourceIdp, SUM(count) AS count FROM ".$table_name." GROUP BY year, month, sourceIdp HAVING sourceIdp != ''");
$sql="SELECT SUM(count) AS count FROM ".$table_name." WHERE year = ".$dateTime->format('Y')." AND month=".$dateTime->format('m')." AND day = ".$dateTime->format('d');
$result=$conn->query($sql);
$stmt=$conn->prepare("SELECT SUM(count) AS count FROM ".$table_name." WHERE year = ".$dateTime->format('Y')." AND month=".$dateTime->format('m')." AND day = ".$dateTime->format('d'));
$sql="SELECT AVG(count) as avg_count FROM (SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year,month,day ) AS average_count;";
$result=$conn->query($sql);
$stmt=$conn->prepare("SELECT AVG(count) as avg_count FROM (SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year,month,day ) AS average_count;");
$sql="SELECT MAX(count) as max_count FROM (SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year,month,day ) AS maximal_count;";
$result=$conn->query($sql);
$stmt=$conn->prepare("SELECT MAX(count) as max_count FROM (SELECT year, month, day, SUM(count) AS count FROM ".$table_name." GROUP BY year,month,day ) AS maximal_count;");