What are the dates of all documents?
select document_date from documents
What about those with 'GV' type expenses?
select t1.document_date from documents as t1 join documents_with_expenses as t2 on t1.document_id = t2.document_id where t2.budget_type_code = 'GV'
What about those with 'SF' type expenses?
select t1.document_date from documents as t1 join documents_with_expenses as t2 on t1.document_id = t2.document_id where t2.budget_type_code = 'SF'
Show the dates for the documents with both types.
select t1.document_date from documents as t1 join documents_with_expenses as t2 on t1.document_id = t2.document_id where t2.budget_type_code = 'GV' intersect select t1.document_date from documents as t1 join documents_with_expenses as t2 on t1.document_id = t2.document_id where t2.budget_type_code = 'SF'