时间:2021-07-01 10:21:17 帮助过:1人阅读
create table test(st_name varchar, st_id int, class_id int, class_info int);
insert into test values(‘MARK‘, 1, 100, ‘MATH‘);
insert into test values(‘YEN‘, 2, 101, ‘CHEM‘);
insert into test values(‘MARK‘, 3, 100, ‘MATH‘);
insert into test values(‘MARK‘, 4, 103, ‘HOST‘);
SELECT (MAX(counter) > 1) as sameClass FROM (SELECT COUNT(st_id) counter FROM test
WHERE ST_ID IN (1,2) GROUP BY class_info);
SELECT (MAX(counter) > 1) as sameClass FROM (SELECT COUNT(st_id) counter FROM test
WHERE ST_ID IN (1,2,3) GROUP BY class_info);
SQL/ SEARCHING 按ClassId查询
标签:where sql HERE inf rom insert tab arc ble