sql pilih di mana id tidak ada di tabel lain
where ID not in(select ID from T2 where HISTORY_FLG!=1)
Graceful Grouse
where ID not in(select ID from T2 where HISTORY_FLG!=1)