Jump to content


Photo

Chart from my table data


  • Please log in to reply
2 replies to this topic

#1 gmc1103

gmc1103
  • Members
  • PipPipPip
  • Advanced Member
  • 205 posts

Posted 20 March 2017 - 08:17 PM

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 



#2 NigelRel3

NigelRel3
  • Members
  • PipPipPip
  • Advanced Member
  • 69 posts

Posted 21 March 2017 - 07:13 AM

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



#3 gmc1103

gmc1103
  • Members
  • PipPipPip
  • Advanced Member
  • 205 posts

Posted 21 March 2017 - 10:48 AM

Hi

 

Thank you.

For the first item yes it does, but i have 5 items, then i want the percentage of each one.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users