I want to generate the report by replace the RC code where the value of 81001 in report is referring to table of m8100x where the column of MRC code is same with the RC code , so if the RC code in the report is 81001 then it display column of RC Code 1 where the value is 3001 and column of RC Code 2 where the value is 1820 but it will not display the column that contain value of 0 .Then if the RC code in the report is 81002 then it will display column of RC Code 1 where the value is 3001,RC Code 2 where the value 5708 , RC Code 3 where the value is 7751 , RC Code 4 is 6001 and RC Code 5 is 5273.... etc
$sql = "select site ,name, (select rc_code from tbl_rc where name=nov.name) as rc_code, SUM(cpu_count) as vcpu, SUM(memory_size_ingb) AS mem_gb, SUM(disk_space_size_ingb) as storage_gb, SUM(backup) as backup, COUNT(date)as daycount, (SUM(cpu_count)*(select vcpu from price_tag where site=nov.site)+SUM(memory_size_ingb)*(select memory from price_tag where site=nov.site)+SUM(disk_space_size_ingb)*(select storage from price_tag where site=nov.site)+SUM(backup)*(select backup from price_tag where site=nov.site))*(count(date)/$d) as 'total' FROM nov where site = '".$site."' and month(date) = '".$mdate."' and year(date) = '".$ydate."' GROUP BY site,name having rc_code<90000";
From novice to tech pro — start learning today.