SELECT TOP 5000 hipp.hip, id, SQRT(POWER(hipp.pmra,2)+POWER(hipp.pmdec,2))/1000 AS pmtothip, SQRT(POWER(t2.pmra,2)+POWER(t2.pmde,2))/1000 AS pmtott2 FROM hipparcos as hipp JOIN tycho2 AS t2 ON ( 1=CONTAINS( POINT('ICRS', hipp.ra, hipp.dec), CIRCLE('ICRS', t2.ra, t2.dec, 0.001)))