Select g.ra, g.dec, zmypnt, ymjpnt, jmhpnt, hmk_1pnt, zapermag3, 
yapermag3, japermag3, hapermag3, k_1apermag3, 3.6e6*cos(radians(g.dec))* 
(g.ra-T2.ra)/((mj.mjdobs - T2.jdate+2400000.5)/365.25) as pmRA, 
3.6e6*(g.dec-T2.dec)/ ((mj.mjdobs - T2.jdate+2400000.5)/365.25) as pmDEC 
From gcsmergelog as I, multiframe as mj, (Select t.ra as ra, t.dec as dec, 
x.slaveobjid as slaveobjid, x.masterobjid as masterobjid, t.j_m, t.h_m, 
t.k_m, t.jdate From gcssourcextwomass_psc as x, twomass..twomass_psc as t 
Where x.slaveobjid=t.pts_key And distancemins In (Select Min(distancemins) 
From gcssourcextwomass_psc Where masterobjid=x.masterobjid)) As T2 Right 
Outer Join gcssource As g On (g.sourceid=T2.masterobjid) Where (g.ra 
Between 235.0 And 245.0) And (g.dec Between -30.0 And -27.0) And zapermag3 
> 14.0 And yapermag3 > 11.5 And japermag3 > 12.0 And hapermag3 > 10.0 And 
k_1apermag3 > 9.5 And zxi Between -1.0 And +1.0 And yxi Between -1.0 And 
+1.0 And jxi Between -1.0 And +1.0 And hxi Between -1.0 And +1.0 And k_1xi 
Between -1.0 And +1.0 And zeta Between -1.0 And +1.0 And yeta Between -1.0 
And +1.0 And jeta Between -1.0 And +1.0 And heta Between -1.0 And +1.0 And 
k_1eta Between -1.0 And +1.0 And zclass Between -2 And -1 And yclass 
Between -2 And -1 And jclass Between -2 And -1 And hclass Between -2 And 
-1 And k_1class Between -2 And -1 And (priorsec = 0 Or priorsec = 
g.framesetid) And g.framesetid=I.framesetid And I.jmfid=mj.multiframeid

