SQL筛选两个字段同时满足条件的结果
现在有一张student表,包含三个字段:s_id,c_id,s_score。
目的1:只保留得到s_id为01,s_score为80的结果
输入语句:
select * from score where case when s_id =01 and s_score =80 then 0 else 1 end=
0;
结果:
目的2:筛选除同时满足s_id为01,s_score为80以外的所有数据
输入语句:
select * from score where case when s_id =01 and s_score =80 then 0 else 1 end=
1;
输出结果: