GALEX GR6/7 has been cross matched against SDSS DR12.  Because a 5" 
search radius was used to perform the matching, there is the possibility 
of many multiple matches. There one table and one view currently available 
for use.

SDSS SD12 has been replaced by DR14, objid's have not changed, queries below
have been modified to join against DR14 instead of D412 which no longer exists.

1. xSDSSDR12 - the matched table
2. SDSSDR14.photoobjall - SDSS DR14 photoobjall table in the SDSSDR14 context.

Note, first, that the cross-matching is based exclusively on these two 
tables, and the results are based entirely on the distance between the 
coordinates of neighboring objects in these catalogs. Thus, the nominal 
'best matches' are those for which the distance of potential matched 
pairs is the smallest.  Second, matches can be made of GALEX against
SDSS objects as well as SDSS against GALEX -- two mirror-symmetric 
operations which may well not give the same paired results. Third, a 
single GALEX object can match more than one SDSS object and of course vice 
versa.

  To illustrate the second point, imagine three objects isolated in 
the sky, two taken from the GALEX catalog and one from the SDSS, and
that the objects are aligned in a straight line in the sky. Let the first 
GALEX object be 2.7 arcsec to the left of the SDSS object and the second 
GALEX object be 2.8 arcsec to the right of the SDSS one. For simplicity
assume further that the PSFs and the positional uncertainties of all
three objects are the same. Then, the GALEX cross-correlation against 
the SDSS objects will find best matches of the same GALEX object. 
Meanwhile, the match of SDSS to GALEX would show two possible matches, 
with the GALEX object 1 on the left having a slightly better match 
(rank = 1) than the GALEX object on the right (rank = 2).  Unambiguous, 
1-to-1 matches on both GALEX-to-SDSS and SDSS-to-GALEX operations will 
result only if all objects find no neighbors from the other catalog 
within the search radius of 5 arcsec.

At the moment there is ongoing research into identifying rigorous 
probabilities following the algorithms found in 
http://adsabs.harvard.edu/abs/2009ApJ...694.1281B . However, 
these are not yet available. When these become available these
will be more definitive.


---------------------------------------------------------------------------

the xSDSSDR12 table contains the following columns.

objid - unique GALEX object identifier

SDSSobjid - unique SDSS object identifier

dstArcSec - angular separation in arc seconds, the radius used for matching is 5"

In lieu of actual probabilities of matches, the following columns 
have been added to the table to facilitate selection of matched sources.
Again, the user should be aware of that the best (closest) match is 
not always the correct one. However, as a first cut best results can 
be obtained from rank = 1 matches and reverse matches across both 
catalogs.

distanceRank - an integer, where a value of 1 indicates that for a given GALEX
object with an SDSS match, that match is the closest, a value of 2 indicates 
the next closest, etc. 

reverseDistanceRank - an integer, where a value of 1 indicates that for
a given SDSS object with a GALEX match, that match is the closest, value of
2 indicates the next closest, etc.

multipleMatchCount - an integer, for any given GALEX object how many SDSS
objects it matched, for example a value of 1 indicates the GALEX object
only matched 1 SDSS object within the 5" match radius.

reverseMultipleMatchCount - an integer, for any given SDSS object how many GALEX
objects it matched, for example a value of 1 indicates the SDSS object
only matched 1 GALEX object within the 5" match radius.


--------------------------------------------------------------------------------
SDSSDR14.photoobjall 
Click here for a description of the columns in SDSSDR14.photoobjall

Here's a defintion of some of those columns.

objid - unique SDSS object identifier
ra - J2000 right ascension
dec - J2000 declination
fiberMag_r - Flux in 3 arcsec diameter fiber radius
u - Shorthand alias for modelMag
g - Shorthand alias for modelMag
r - Shorthand alias for modelMag
i - Shorthand alias for modelMag
z - Shorthand alias for modelMag
type - Morphological type classification of the object.
probPSF - Probability that the object is a star. Currently 0 if type == 3 (galaxy)  1 if type == 6 (star).


the SDSSDR14.photoobjall column named type can have the following values.

name		value	description
UNKNOWN		0	Unknown: Object type is not known.
COSMIC_RAY	1	Cosmic-ray track (not used).
DEFECT		2	Defect: Object is caused by a defect in the telescope or processing pipeline. (not used)
GALAXY		3	Galaxy: An extended object composed of many stars and other matter.
GHOST		4	Ghost: Object created by reflected or refracted light. (not used)
KNOWNOBJ	5	KnownObject: Object came from some other catalog (not the SDSS catalog). (not yet used)
STAR		6	Star: A a self-luminous gaseous celestial body.
TRAIL		7	Trail: A satellite or asteriod or meteor trail. (not yet used)
SKY		8	Sky: Blank sky spectogram (no objects in this arcsecond area).
NOTATYPE	9	NotAType:


--------------------------------------------------------------------------------
Some sample queries are shown below. The queries assume that you are using
GALEX CASJobs, http://galex.stsci.edu/casjobs/ and that you have imported
a list of objects or coordinates.  For all but Query 1 assume also that 
you have performed the Neighbors function in CASJobs to find GALEX 
matches. You can also import the two following files into tables galexIds
and testMatches to test the queries below.
galexIds
testMatches

Let's assume you've done the prior steps and the result is stored in a 
table named testMatches with the following columns.

id - your source identifier ("your" is given the "my" prefix in the SQL
   texts)
ra - your source right ascension
dec - your source declination
search_id - integer id created and assigned by CASJobs
matched_id - GALEX id matched to id/search_id


Within CASJobs set your context to GALEX_GR6Plus7

The samples below use "top 25" in the select clause. This will show
results relatively quickly in case there are numerous matches. 
The "top 25"  clause can be removed when the result set is required 
for all the input objects.

--------------------------------------------------------------------------------
Query 1:
  
Display the GALEX survey, photometry, exposure time, and angular 
separation for all SDSS matches within 5 arcseconds of an input target 
list galexIDs. The results table lists numbers of matches, reverse 
matches (SDSS against GALEX objects), and the ranks of multiple matches 
and reverse matches.  The output will show all the GALEX magnitudes, 
magnitude errors, and reddenings as well as the SDSS colors for the 
matches. Again, Query 1 is the only example supporting an input list 
of known GALEX objects, consisting of a 1-column list of ObjectId's. 
(Queries 2-5 will show matches for an input (3-column) list of arbitrary 
object names and coordinates.)


select m.gid as myid,
pe.mpstype as survey, pe.nexptime as nuvExposureTime,
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr,
g.fuv_mag, g.fuv_magErr,
g.e_bv,
x.dstArcSec as GToSDstArcSec, x.distanceRank, x.reverseDistanceRank,
x.multipleMatchCount, x.reverseMultipleMatchCount,
s.objid, s.ra as sra, s.dec as sdec,
s.fiberMag_r, s.u, s.g, s.r, s.i, s.z, s.type, s.probPSF
from mydb.galexIds as m
INNER JOIN photoobjall as g on m.gid=g.objid
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid
INNER JOIN xSDSSDR12 as x on m.gid=x.objid
INNER JOIN SDSSDR14.photoobjall as s on x.SDSSObjid=s.objid

--------------------------------------------------------------------------------
Query 2:

Display GALEX photometry, survey, exposure time, angular separation,
Galactic reddening for matches for your list of objects coordinates 
in testMatches.  This query operates only on the GALEX catalog.


select top 25 m.id as myid,
dbo.fDistanceArcMinEQ(m.ra,m.dec,g.ra,g.dec)*60.0 as dstArcSec,
pe.mpstype as survey, pe.nexptime as nuvExposureTime, 
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr, 
g.fuv_mag, g.fuv_magErr,
g.e_bv
from mydb.testMatches as m
INNER JOIN photoobjall as g on g.objid=m.matched_id
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid

--------------------------------------------------------------------------------
Query 3:

Same query as #2 but now include ALL SDSS matches and angular separation
between your input object coordinate list and SDSS objects. 

select top 25 m.id as myid,
dbo.fDistanceArcMinEQ(m.ra,m.dec,g.ra,g.dec)*60.0 as dstArcSec,
pe.mpstype as survey, pe.nexptime as nuvExposureTime, 
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr, 
g.fuv_mag, g.fuv_magErr,
g.e_bv, 
x.dstArcSec as GToSDstArcSec, x.distanceRank, x.reverseDistanceRank,
x.multipleMatchCount, x.reverseMultipleMatchCount,
dbo.fDistanceArcMinEQ(m.ra,m.dec,s.ra,s.dec)*60.0 as MToSDstArcSec,
s.objid, s.ra as sra, s.dec as sdec,
s.fiberMag_r, s.u, s.g, s.r, s.i, s.z, s.type, s.probPSF
from mydb.testMatches as m
INNER JOIN photoobjall as g on m.matched_id=g.objid
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid
INNER JOIN xSDSSDR12 as x on m.matched_id=x.objid
INNER JOIN SDSSDR14.photoobjall as s on x.SDSSObjid=s.objid

--------------------------------------------------------------------------------
Query 4:

Same query as #3 but include SDSS matches and angular separation 
between your input coordinate list and SDSS objects. Further refine 
the query to include only the case where the GALEX source matches only 
ONE SDSS source and vice versa. This is the most restrictive query 
of our examples, so you will typically get the fewest matches.

select top 25 m.id as myid,
dbo.fDistanceArcMinEQ(m.ra,m.dec,g.ra,g.dec)*60.0 as dstArcSec,
pe.mpstype as survey, pe.nexptime as nuvExposureTime, 
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr, 
g.fuv_mag, g.fuv_magErr,
g.e_bv, 
x.dstArcSec as GToSDstArcSec, x.distanceRank, x.reverseDistanceRank,
x.multipleMatchCount, x.reverseMultipleMatchCount,
dbo.fDistanceArcMinEQ(m.ra,m.dec,s.ra,s.dec)*60.0 as MToSDstArcSec,
s.objid, s.ra as sra, s.dec as sdec,
s.fiberMag_r, s.u, s.g, s.r, s.i, s.z, s.type, s.probPSF
from mydb.testMatches as m
INNER JOIN photoobjall as g on m.matched_id=g.objid
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid
INNER JOIN xSDSSDR12 as x on m.matched_id=x.objid
INNER JOIN SDSSDR14.photoobjall as s on x.SDSSObjid=s.objid
and x.distanceRank=1
and x.reverseDistanceRank=1
and x.multipleMatchCount=1
and x.reverseMultipleMatchCount=1

--------------------------------------------------------------------------------
Query 5:

Same query as #3 but include SDSS matches and angular separation
between your input coordinate list and SDSS sources. This query includes 
only the CLOSEST GALEX to SDSS match. As noted above, this does not 
insure that the candidate GALEX match is the best one for an SDSS object.

select top 25 m.id as myid,
dbo.fDistanceArcMinEQ(m.ra,m.dec,g.ra,g.dec)*60.0 as dstArcSec,
pe.mpstype as survey, pe.nexptime as nuvExposureTime, 
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr, 
g.fuv_mag, g.fuv_magErr,
g.e_bv, 
x.dstArcSec as GToSDstArcSec, x.distanceRank, x.reverseDistanceRank,
x.multipleMatchCount, x.reverseMultipleMatchCount,
dbo.fDistanceArcMinEQ(m.ra,m.dec,s.ra,s.dec)*60.0 as MToSDstArcSec,
s.objid, s.ra as sra, s.dec as sdec,
s.fiberMag_r, s.u, s.g, s.r, s.i, s.z, s.type, s.probPSF
from mydb.testMatches as m
INNER JOIN photoobjall as g on m.matched_id=g.objid
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid
INNER JOIN xSDSSDR12 as x on m.matched_id=x.objid
INNER JOIN SDSSDR14.photoobjall as s on x.SDSSObjid=s.objid
and x.distanceRank=1
and x.reverseDistanceRank=1

--------------------------------------------------------------------------------
Query 6:

Same query as #3 but include GALEX matches which DON'T have corresponding
SDSS matches. 

select top 25 m.id as myid,
dbo.fDistanceArcMinEQ(m.ra,m.dec,g.ra,g.dec)*60.0 as dstArcSec,
pe.mpstype as survey, pe.nexptime as nuvExposureTime, 
pe.fexptime as fuvExposureTime,
g.nuv_mag, nuv_magErr, 
g.fuv_mag, g.fuv_magErr,
g.e_bv, 
x.dstArcSec as GToSDstArcSec, x.distanceRank, x.reverseDistanceRank,
x.multipleMatchCount, x.reverseMultipleMatchCount,
dbo.fDistanceArcMinEQ(m.ra,m.dec,s.ra,s.dec)*60.0 as MToSDstArcSec,
s.objid, s.ra as sra, s.dec as sdec,
s.fiberMag_r, s.u, s.g, s.r, s.i, s.z, s.type, s.probPSF
from mydb.testMatches as m
INNER JOIN photoobjall as g on m.matched_id=g.objid
INNER JOIN photoextract as pe on pe.photoextractid=g.photoextractid
LEFT OUTER JOIN xSDSSDR12 as x on m.matched_id=x.objid
LEFT OUTER JOIN SDSSDR14.photoobjall as s on x.SDSSObjid=s.objid