CREATE TABLE `student` (
`name` varchar(10) DEFAULT NULL,
`subject` varchar(10) DEFAULT NULL,
`score` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
INSERT INTO student VALUES('liming','eng',90);
INSERT INTO student VALUES('liming','math',90);
INSERT INTO student VALUES('tom','math',93);
INSERT INTO student VALUES('tom','eng',91);
select *
from student
where
CASE
when score = 90 then name in ('liming', 'tom')
when score = 91 then name in ('liming', 'tom')
END

posted on
浙公网安备 33010602011771号