SQL SELECT WHERE ID no existe en otra tabla
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)