Well, the self-join example of Jeff and Pat is exactly what I feel would be more easily expressed with a sphericalDistance function:
>select
> s1.csys, s1.obsra, s1.obsdec, s1.z, s1.specid, s1.targetname, s1.quality
>from
> spectra as s1 JOIN spectra as s2 ON INTERSECTS(
> POINT(s1.csys, s1.obsra, s1.obsdec)
> CIRCLE(s2.csys,s2.obsra, s2.obsdec, 0.001) ) = 1
>where
> s2.quality > 3 and s2.redshift > 1.6
expressed e.g. as
select s1.obsra, s1.obsdec, s1.z, s1.specid, s1.targetname, s1.quality
from spectra as s1, spectra as s2
where sphericalDistance(s1.obsra, s1.obsdec, s2.obsra, s2.obsdec) <= 0.001
and s2.quality > 3 and s2.redshift > 1.6 (the condition could be included in the from clause as a join if preferred).
This way removes all STC issues.
Just another comment: the INTERSECT looks strange in this context of a point and a circle -- OVERLAP would look more logical...
Francois Ochsenbein ------ Observatoire Astronomique de Strasbourg 11, rue de l'Universite F-67000 STRASBOURG Phone: +33-(0)390 24 24 29 Email: francois-at-astro.u-strasbg.fr (France) Fax: +33-(0)390 24 24 17 ================================================================================Received on 2008-05-14Z23:21:18