現在有一張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;
輸出結果: