Problem in Union of Records

Condition1:
ID who has:

  • NOT received type “A period (TableA, Table B)

AND

  • Not received type “B”(TableA, TableB, TableC)

AND

  • Not received Type”D” (TableA)

AND

  • HAS received Type “E” (TableA, TableC, Table B)

Condition2:
Id receives "C" diagnosis in trigger period (tableA)
I need Id which should have C and {should not be A,
Should not be B,
Should not be D ,
Should be E}
How to do?
What I did was
I created table with Id which has type A-------Table 1
“ “ “ B ----------Table2
“ “ D -------table 3
“ “ “ which does not has E
I did union of the above tables that is
Create table5 as
Select distinct Id from Table1
Union
Select distinct Id from Table2
Union
Select distinct Id from Table3
Union
Select distinct Id from Table4

Then I did
Select id from table A which is not in (select id from table5)
But I’m not getting the Id which satisfies E condition
Can some one help me?

Pretty hard to understand what you're talking about. To help us would please post:

CREATE TABLE statements for all tables involved
INSERT INTO statements for all table involved to populate them with test data that cover all the permutations of your conditions
Desire results of your query, from test data (above).