select * from empcource left join empinfo ON empcource.cource_desc in ( 'english','chinese');


c01 chinese 001 002 c02 81
c01 chinese 002 002 c02 81
c01 chinese 002 001 c02 81
c01 chinese 001 001 c01 95
c01 chinese 003 001 c04 89
c02 english 001 002 c02 81
c02 english 002 002 c02 81
c02 english 002 001 c02 81
c02 english 001 001 c01 95
c02 english 003 001 c04 89
c03 math    


附:
empcource:

CREATE TABLE `empcource` (
  `cource_id` varchar(10) NOT NULL,
  `cource_desc` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`cource_id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk


c01 chinese
c02 english
c03 math

 


empinfo:

CREATE TABLE `empinfo` (
  `name_id` varchar(10) NOT NULL,
  `class` varchar(10) NOT NULL,
  `cource_id` varchar(10) NOT NULL,
  `score` int(11) DEFAULT '0',
  KEY `classname` (`name_id`,`class`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk


001 002 c02 81
002 002 c02 81
002 001 c02 81
001 001 c01 95
003 001 c04 89

 

无条件左连接,然后选择满足条件english chinese 的项