if object_id ('bioRecord') is not null drop table bioRecord

select *
into bioRecord
from syn_world.dbo.bioRecord
where bioRecordResourceKey in (
	-- BfN-Datenbanken
	select resourceKey 
	from syn_world.dbo.resource 
	where dataset_uuid in ('36c6ba38-1387-11e2-bb2e-00145eb45e9a', 'ad0d1a24-e952-11e2-961f-00145eb45e9a') 
)	
or  (  bioRecordCountryCode = 'DE'
    and bioRecordTaxonKey in
		(select distinct taxonKey 
		 from syn_world.dbo.higherTaxon
		 where higherTaxonName = 'Plantae'
		    or higherTaxonName like '%phyceae')
)