<?php   include_once('../config/db.php');   include_once('../config/check2.php');
             

$query = "      SELECT coalesce(SUM(answer),0)ans,dname,type  FROM (
									   
                         SELECT a.*,b.id bid,b.scope bscope,b.transid bassesment,c.client,
                                                  c.uid cuid,d.name dname
                    from cassesmentdata a LEFT JOIN cassesmentitem b ON a.transid=b.id
                                        LEFT JOIN cassesment c ON b.transid=c.id 
                                        LEFT JOIN admcategory d ON a.type= d.id 
                                        
                              )x  WHERE  cuid='$uid'  GROUP BY x.type                                
                    ";

$result = $conn->query($query);
$data = [];
		    foreach ($result as $row) {
		                                $data[] = $row;
		                             }

print json_encode($data);

///MONTH(b.date)

