wiki:db/queries/023
Last modified 7 years ago Last modified on 02/01/2013 06:21:25 AM

Find all galaxies without saturated pixels within certain distance of a given point

declare @saturated bigint;                              -- initialize "saturated" flag
set     @saturated = dbo.fPhotoFlags('saturated');      -- avoid SQL2K optimizer problem

select  G.objectId, GN.distance                         -- return Galaxy Object ID and angular distance (arc min)
from    Galaxy                      as G                -- join Galaxies with
join    fGetNearbyObjEq(195,2.5, 1) as GN USING (objectId)  -- objects within ' of ra=195 & dec=2.5
where (G.flags & @saturated) = 0                        -- not saturated
order by distance                                       -- sorted nearest first

Todo: understand how to rework flags and functions, don't have them in LSST schema

fGetNearbyObjEq is described here: http://cas.sdss.org/dr5/en/help/browser/description.asp?n=fGetNearbyObjEq&t=F

fPhotoFlags is described here: http://cas.sdss.org/dr5/en/help/browser/description.asp?n=fPhotoFlags&t=F

This query originally came from SDSS (S-1)