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

select bioRecord.* 
into bioRecord
from syn_world.dbo.bioRecord
where bioRecordResourceKey in 
	(select resourceKey from syn_world.dbo.resource where dataset_uuid in
		('848e55dc-f762-11e1-a439-00145eb45e9a','7a22e1e4-f762-11e1-a439-00145eb45e9a','85685a84-f762-11e1-a439-00145eb45e9a','856734ce-f762-11e1-a439-00145eb45e9a','85ad6c96-f762-11e1-a439-00145eb45e9a','83f90252-f762-11e1-a439-00145eb45e9a','7f4ed916-f762-11e1-a439-00145eb45e9a','41754ccf-f293-4183-b0fe-5efbdffe597c','85fc0ce8-f762-11e1-a439-00145eb45e9a','7b117ea6-29b0-4575-8cff-c7af7283340f','eb9f8323-02f8-4e10-a9e6-48fca6cb3f72','856bc8c2-f762-11e1-a439-00145eb45e9a','856cdf96-f762-11e1-a439-00145eb45e9a','857846ba-f762-11e1-a439-00145eb45e9a','96aa3736-f762-11e1-a439-00145eb45e9a','96a90488-f762-11e1-a439-00145eb45e9a','86b65c92-f762-11e1-a439-00145eb45e9a','82c788c2-f762-11e1-a439-00145eb45e9a','570489ac-e114-4a17-9340-2e01ee7d9ee3','8597c530-f762-11e1-a439-00145eb45e9a','81264d96-f762-11e1-a439-00145eb45e9a','8601bda0-f762-11e1-a439-00145eb45e9a','866a0414-f762-11e1-a439-00145eb45e9a','12475130-8b28-11de-b647-b8a03c50a862','83459d16-f762-11e1-a439-00145eb45e9a','17a729a0-7ed1-11df-8c4a-0800200c9a66','85969598-f762-11e1-a439-00145eb45e9a','981774b0-d887-42c8-9ef7-fd6643142896','96b66524-f762-11e1-a439-00145eb45e9a','8908a9a0-f762-11e1-a439-00145eb45e9a','f2836770-6166-11de-84bf-b8a03c50a862','2e69f69c-703f-11e2-ad8f-00145eb45e9a','d44f84b0-e947-11e2-961f-00145eb45e9a','5e6ae014-b62f-11e2-afcb-00145eb45e9a','ee9c2798-1637-11e3-b987-00145eb45e9a','482b6e73-5135-4bba-8be7-9c12460130c0','f60aa56f-cbb7-4f55-8a6d-67288d5ba9b1','4894f2f8-74b5-403e-bd8d-6fe5123a3f71','40d2de00-0c6e-11dd-84d2-b8a03c50a862','80959102-f762-11e1-a439-00145eb45e9a','9f9286fe-ca42-4195-874b-13dc6f5d4861','e314f3fc-ffd0-4a43-baa0-73d7a271e5f9','3c56f66d-d47e-43cd-b51d-180f21c619ae')
	)
or bioRecordTaxonKey IN
	(select distinct taxonKey 
	 from syn_world.dbo.higherTaxon
	 where higherTaxonName in 
		('Protozoa', ' Cryptophyta', 'Haptophyta', 'Bodonophyceae', 'Bolidophyceae', 'Chrysophyceae', 'Coscinodiscophyceae', 'Craspedophyceae', 'Cyanobacteria', 'Bacillariophyta', 'Chlorophyta', 'Cyanidiophyta', 'Glaucophyta', 'Prasinophyta', 'Rhodophyta', 'Chloromonadaceae')
	)