Jump to content
Sign in to follow this  
gmc1103

Chart from my table data

Recommended Posts

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 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi

 

Thank you.

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.