我有以下的数据库结构,许多一对多查询
CREATE TABLE IF NOT EXISTS `analyze` (
`disease_id` int(11) NOT NULL,
`symptom_id` int(11) NOT NULL
) ;
CREATE TABLE IF NOT EXISTS `disease` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ;
CREATE TABLE IF NOT EXISTS `symptom` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(4) NOT NULL,
PRIMARY KEY (`id`)
) ;
编辑: 对不起,我的意思是我该如何识别来自输入症状的疾病。 例如: 如果我有症状:发烧和咳嗽,那么我会感冒。 如果我有症状:喉咙痛和发烧,那么我会有喉咙感染。 输入是$symptom1
,$symptom2
,$symptom3
等等。
谢谢。
您可能想在查询中添加d.name(以及group by) – potatopeelings 2010-06-22 08:29:50