-- Galaxies meeting two simple criteria. 
-- Find all galaxies brighter than r magnitude 17, where the local
-- extinction is > 0.275.  This is a simple query that uses a WHERE clause,
-- but now two conditions that must be met simultaneously.
--
-- Finds 6604 galaxies in under 10 mins on DR2, but beware that increasing
-- the limiting r magnitude will significantly add to the execution time.

SELECT objID 
FROM Galaxy 
WHERE 
  r < 17			-- r IS NOT deredenned
  and extinction_r > 0.275	-- extinction more than 0.175
