-- Get object velocities and errors.  
-- This is also a simple query that uses a WHERE clause. 
-- However, now we perform a more complex mathematical operation.

SELECT TOP 10 
  run,	   -- get a bunch of quantities
  camCol,
  field,
  objID,
  rowC, colC, rowV, colV, rowVErr, colVErr,
  flags,
  psfMag_u, psfMag_g, psfMag_r, psfMag_i, psfMag_z,
  psfMagErr_u, psfMagErr_g, psfMagErr_r, psfMagErr_i, psfMagErr_z
FROM PhotoPrimary
WHERE	 ((rowv * rowv) / (rowvErr * rowvErr) + 
       (colv * colv) / (colvErr * colvErr) > 4)

-- where the velocities are reliable
