gmc1103 Posted March 20, 2017 Share Posted March 20, 2017 Hi I need some help regarding a chart i'm trying to make regarding my table data This is the structure CREATE TABLE `rel_atividades_avaliacao` ( `id_avaliacao` int(11) NOT NULL AUTO_INCREMENT, `id_atividades` int(11) NOT NULL, `avaliado` varchar(3) COLLATE utf8_bin NOT NULL DEFAULT '-1', `data_prevista` varchar(50) COLLATE utf8_bin NOT NULL, `motivo` varchar(300) COLLATE utf8_bin DEFAULT '-', `adequacaos` int(11) NOT NULL, `participacaos` int(11) NOT NULL, `consecucaos` int(11) NOT NULL, `disps` int(11) NOT NULL, `mats` int(11) NOT NULL, `balanco` varchar(300) COLLATE utf8_bin NOT NULL, `ficheiro` varchar(300) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`id_avaliacao`), KEY `id_atividades` (`id_atividades`), CONSTRAINT `rel_atividades_avaliacao_ibfk_1` FOREIGN KEY (`id_atividades`) REFERENCES `atividades` (`id_atividades`) ON DELETE CASCADE ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=533 DEFAULT CHARSET=utf8 COLLATE=utf8_bin The chart should be regarding those 5 elements `adequacaos` int(11) NOT NULL, `participacaos` int(11) NOT NULL, `consecucaos` int(11) NOT NULL, `disps` int(11) NOT NULL, `mats` int(11) NOT NULL, Those 5 elements accept numbers between 1 to 5, 1(poor) and 5 (Excellent) So my chart must be how many times 1, 2,3,4,5 has been chosed in each table atributes Any help? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/303506-chart-from-my-table-data/ Share on other sites More sharing options...
NigelRel3 Posted March 21, 2017 Share Posted March 21, 2017 If you want to fetch each value separately then SELECT `adequacaos`, count(`adequacaos`) FROM `rel_atividades_avaliacao` group by `adequacaos`; should give you some totals Quote Link to comment https://forums.phpfreaks.com/topic/303506-chart-from-my-table-data/#findComment-1544430 Share on other sites More sharing options...
gmc1103 Posted March 21, 2017 Author Share Posted March 21, 2017 Hi Thank you. For the first item yes it does, but i have 5 items, then i want the percentage of each one. Quote Link to comment https://forums.phpfreaks.com/topic/303506-chart-from-my-table-data/#findComment-1544443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.