a. table situation:
CREATE TABLE `situation` (
`id_situation` tinyint(3) NOT NULL auto_increment,
`situation` varchar(20) NOT NULL default '',
PRIMARY KEY (`id_situation`)
) TYPE=MyISAM ;
b. table documents:
CREATE TABLE `document` (
`id_document` int(8) unsigned NOT NULL auto_increment,
`id_situation` tinyint(3) unsigned NOT NULL default '1',
`regdate` date NOT NULL default '0000-00-00',
`notes` text NOT NULL,
PRIMARY KEY (`id_document`)
) TYPE=MyISAM ;
What i need is to show for each record of the table situation how many records exists in the table documents, i try this SELECT:
select situation.id_situation, situation.situation, count(document.id_situation) as totdocs
from situation, documents
where situation.id_situation=document.id_situation
group by situation.id_situation
order by situation.situation;
but it does not show the correct values.
Best regards,

