/home/www/vhosts/maos.inogs.it/stat/prj_ins_num_stat.php SELECT Count(d.id_drifter) AS quanti,'Drifter' as type, EXTRACT (YEAR from d.deployment_time) AS anno FROM ((tbl_type as y RIGHT JOIN tbl_drifter as d ON y.id_type = d.id_type) LEFT JOIN tbl_img_web_drifter ON d.id_drifter = tbl_img_web_drifter.id_drifter) LEFT JOIN (tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) ON tbl_img_web_drifter.id_web_pages = i.id_web_pages WHERE d.daelaborare=TRUE $str_sql_where GROUP BY type, anno ORDER BY type UNION SELECT count(d.id_float), "Float" as type, EXTRACT (YEAR from d.deployment_time) as anno FROM ((tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) RIGHT JOIN (tbl_float as d LEFT JOIN tbl_img_web_float ON d.id_float = tbl_img_web_float.id_float) ON i.id_web_pages = tbl_img_web_float.id_web_pages) LEFT JOIN tbl_type as y ON d.id_type = y.id_type WHERE no_in_table_web=FALSE $str_sql_where group by anno, type order by anno UNION SELECT count(d.id_deploy_glider), "Glider" as type, EXTRACT (YEAR from d.data_deploy) as anno FROM (tbl_project INNER JOIN (tbl_img_web_glider INNER JOIN tbl_web_pages ON tbl_img_web_glider.id_web_pages = tbl_web_pages.id_web_pages) ON tbl_project.id_project = tbl_web_pages.id_project) INNER JOIN tbl_deploy_glider as d ON tbl_img_web_glider.id_deploy_glider = d.id_deploy_glider group by anno,type order by anno; rimosso group by type


SELECT Count(d.id_drifter) AS quanti,'Drifter' as type FROM ((tbl_type as y RIGHT JOIN tbl_drifter as d ON y.id_type = d.id_type) LEFT JOIN tbl_img_web_drifter ON d.id_drifter = tbl_img_web_drifter.id_drifter) LEFT JOIN (tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) ON tbl_img_web_drifter.id_web_pages = i.id_web_pages WHERE d.daelaborare=TRUE and p.id_project='107' UNION ALL SELECT Count(d.id_float) as quanti, 'Float' as type FROM ((tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) RIGHT JOIN (tbl_float as d LEFT JOIN tbl_img_web_float ON d.id_float = tbl_img_web_float.id_float) ON i.id_web_pages = tbl_img_web_float.id_web_pages) LEFT JOIN tbl_type as y ON d.id_type = y.id_type WHERE no_in_table_web=FALSE and p.id_project='107' UNION ALL SELECT count(d.id_deploy_glider) as quanti, 'Glider' as type FROM (tbl_project as p INNER JOIN (tbl_img_web_glider as i INNER JOIN tbl_web_pages ON i.id_web_pages = tbl_web_pages.id_web_pages) ON p.id_project = tbl_web_pages.id_project) INNER JOIN tbl_deploy_glider as d ON i.id_deploy_glider = d.id_deploy_glider WHERE test_mission=FALSE and maintenance=FALSE and p.id_project='107' ;
SELECT Count(d.id_drifter) AS quanti,'Drifter' as type FROM ((tbl_type as y RIGHT JOIN tbl_drifter as d ON y.id_type = d.id_type) LEFT JOIN tbl_img_web_drifter ON d.id_drifter = tbl_img_web_drifter.id_drifter) LEFT JOIN (tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) ON tbl_img_web_drifter.id_web_pages = i.id_web_pages WHERE d.daelaborare=TRUE and p.id_project='107' UNION ALL SELECT Count(d.id_float) as quanti, 'Float' as type FROM ((tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) RIGHT JOIN (tbl_float as d LEFT JOIN tbl_img_web_float ON d.id_float = tbl_img_web_float.id_float) ON i.id_web_pages = tbl_img_web_float.id_web_pages) LEFT JOIN tbl_type as y ON d.id_type = y.id_type WHERE no_in_table_web=FALSE and p.id_project='107' UNION ALL SELECT count(d.id_deploy_glider) as quanti, 'Glider' as type FROM (tbl_project as p INNER JOIN (tbl_img_web_glider as i INNER JOIN tbl_web_pages ON i.id_web_pages = tbl_web_pages.id_web_pages) ON p.id_project = tbl_web_pages.id_project) INNER JOIN tbl_deploy_glider as d ON i.id_deploy_glider = d.id_deploy_glider WHERE test_mission=FALSE and maintenance=FALSE and p.id_project='107' ;

Full data not grouped
SELECT d.id_drifter AS id,'Drifter' as type FROM ((tbl_type as y RIGHT JOIN tbl_drifter as d ON y.id_type = d.id_type) LEFT JOIN tbl_img_web_drifter ON d.id_drifter = tbl_img_web_drifter.id_drifter) LEFT JOIN (tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) ON tbl_img_web_drifter.id_web_pages = i.id_web_pages WHERE d.daelaborare=TRUE and p.id_project='107' UNION ALL SELECT d.id_float as id, 'Float' as type FROM ((tbl_project as p RIGHT JOIN tbl_web_pages as i ON p.id_project = i.id_project) RIGHT JOIN (tbl_float as d LEFT JOIN tbl_img_web_float ON d.id_float = tbl_img_web_float.id_float) ON i.id_web_pages = tbl_img_web_float.id_web_pages) LEFT JOIN tbl_type as y ON d.id_type = y.id_type WHERE no_in_table_web=FALSE and p.id_project='107' UNION ALL SELECT d.id_deploy_glider as id, 'Glider' as type FROM (tbl_project as p INNER JOIN (tbl_img_web_glider as i INNER JOIN tbl_web_pages ON i.id_web_pages = tbl_web_pages.id_web_pages) ON p.id_project = tbl_web_pages.id_project) INNER JOIN tbl_deploy_glider as d ON i.id_deploy_glider = d.id_deploy_glider WHERE test_mission=FALSE and maintenance=FALSE and p.id_project='107' ORDER BY id;

id_floatproject
1208Float
6282Drifter
6283Drifter
6284Drifter
6286Drifter
6287Drifter
6288Drifter
6289Drifter
6290Drifter
6291Drifter
6292Drifter
6293Drifter
6294Drifter
6295Drifter
6296Drifter
6297Drifter
6298Drifter
6299Drifter
6300Drifter
6301Drifter
6302Drifter
6303Drifter
6304Drifter
6305Drifter
6306Drifter
6307Drifter
6308Drifter
6309Drifter
6310Drifter
6311Drifter
6312Drifter
6313Drifter
6314Drifter
6315Drifter
6316Drifter
6317Drifter
6318Drifter
6319Drifter
6320Drifter
6321Drifter
6322Drifter
6323Drifter
6324Drifter
6325Drifter
6326Drifter
6327Drifter
6328Drifter
6330Drifter
6331Drifter
6332Drifter
6333Drifter
6334Drifter
6335Drifter
6336Drifter
6337Drifter
6338Drifter
6340Drifter
6341Drifter
6342Drifter
6343Drifter
6345Drifter
6347Drifter
6348Drifter
6349Drifter
6350Drifter
6351Drifter
6353Drifter
6354Drifter
6355Drifter
6356Drifter
6357Drifter
6365Drifter
6366Drifter
6367Drifter
6368Drifter
6369Drifter
6370Drifter
6371Drifter
6372Drifter
6373Drifter
6374Drifter
6407Drifter
6408Drifter
6409Drifter
6410Drifter
6411Drifter
6412Drifter
6413Drifter
6414Drifter
6415Drifter
6417Drifter
6418Drifter
6419Drifter
6420Drifter
6421Drifter
6422Drifter
6423Drifter
6424Drifter
6425Drifter
6426Drifter
6427Drifter
6428Drifter
6429Drifter
6430Drifter
6431Drifter
6432Drifter
6437Drifter
6438Drifter
6439Drifter
6440Drifter
6441Drifter
6465Drifter
6466Drifter
6467Drifter
6468Drifter