-- Galaxies with bluer centers.
-- by Michael Strauss. For all galaxies
-- with r_Petro < 18, not saturated, not bright, and not edge, give me those
-- with centers appreciably bluer than their outer parts, i.e., define the
-- center color as: u_psf - g_psf and define the outer color as: u_model -
-- g_model; give me all objs which have (u_model - g_model) - (u_psf - g_psf)
-- < -0.4
-- Another flags-based query.

-- NOTE: This query times out (takes too long) without the "TOP 1000".

SELECT top 1000
  colc_u, colc_g,  objID  
FROM  Galaxy
WHERE 
  ( Flags & (dbo.fPhotoFlags('SATURATED') + 
                dbo.fPhotoFlags('BRIGHT') +  
                dbo.fPhotoFlags('EDGE')) ) = 0 
  and petrorad_r < 18
  and ((colc_u - colc_g) - (psfMag_u - psfMag_g)) < -0.4
