Kami menggunakan 0 = 0
atau, biasanya, 1 = 1
sebagai rintisan :
select *
from My_Table
where 1 = 1
Jadi ketika Anda menulis filter, Anda dapat melakukannya dengan menambahkan/mengomentari baris tunggal :
-- 3 filters added
select *
from My_Table
where 1 = 1
and (Field1 > 123) -- 1st
and (Field2 = 456) -- 2nd
and (Field3 like '%test%') -- 3d
Versi berikutnya, katakanlah, akan menghapus dua filter:
-- 3 filters added, 2 (1st and 3d) removed
select *
from My_Table
where 1 = 1
-- and (Field1 > 123) -- <- all you need is to comment out the corresponding lines
and (Field2 = 456)
-- and (Field3 like '%test%')
Sekarang mari pulihkan filter 3d dengan cara yang sangat mudah:
-- 3 filters added, 2 (1st and 3d) removed, then 3d is restored
select *
from My_Table
where 1 = 1
-- and (Field1 > 123)
and (Field2 = 456)
and (Field3 like '%test%') -- <- just uncomment