
#create a temp table with all taxonKeys that have a higher taxon associated denoting a plant
create temporary table tmpPlantaeTaxa
select distinct taxonKey
from syn_delta.higherTaxon
where higherTaxonName = 'Plantae'
   or higherTaxonName like '%phyceae';

alter table tmpPlantaeTaxa
	add key(taxonKey);

# german plantae records
create table mergeList
select bioRecordKey as brKey
from syn_delta.bioRecord
straight_join tmpPlantaeTaxa	on taxonKey = bioRecordTaxonKey
where bioRecordCountryCode = 'DE';

alter table mergeList
	add primary key (brKey);

# BfN-Datenbanken
insert ignore into mergeList
select bioRecordKey
from syn_delta.bioRecord
where bioRecordResourceKey in (1081, 1098);
