use a common table expression to generate all the combinations, then use an outer join to include the duplicates shown in table3
.
with cte as ( select resource, period
from table1 cross join table2 )
select cte.resource
, cte.period
from cte
left outer join table3
on (table3.resource = cte.resource
and table3.period = cte.period )
;
This may not produce the right answer, depending on what you mean by " I don't know how to get rid of unneccessary rows ". The output you present doesn't appear to discard any rows from the tables and you haven't provided any rules. So, if this doesn't give you what you want you must edit your question to clarify matters.