Skip to content

Instantly share code, notes, and snippets.

@bdunnette
Last active November 28, 2018 16:52
Show Gist options
  • Save bdunnette/1eca90b4ae4bd1131d988a306f8edba8 to your computer and use it in GitHub Desktop.
Save bdunnette/1eca90b4ae4bd1131d988a306f8edba8 to your computer and use it in GitHub Desktop.
USE Aperio
SELECT *
FROM [dbo].[Image]
JOIN [dbo].[Slide] ON Slide.Id=Image.ParentId
LEFT JOIN [dbo].[Specimen] ON Slide.ParentId=Specimen.Id
LEFT JOIN [dbo].[Case] AS CaseStudy ON Specimen.ParentId=CaseStudy.Id
LEFT JOIN [Core].[Stain] ON Slide.StainId=Stain.Id
LEFT JOIN [dbo].[BodySite] ON Slide.BodySiteId=BodySite.Id
WHERE Specimen.DataGroupId = 62
AND Image.CompressedFileLocation != ''
AND Specimen.ParentTable = 'Case'
ORDER BY CaseStudy.PhysicianName ASC, CaseStudy.Id ASC, Specimen.Id ASC, Slide.Id ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment