SELECT DISTINCT ra,
dec,
release,
brickid,
objid,
22.5-2.5*log(flux_g) AS intmag_g_decals,
22.5-2.5*log(flux_r) AS intmag_r_decals,
22.5-2.5*log(flux_z) AS intmag_z_decals,
22.5-2.5*log(flux_w1) AS intmag_w1_decals,
22.5-2.5*log(flux_w2) AS intmag_w2_decals,
22.5-2.5*log(flux_w3) AS intmag_w3_decals,
22.5-2.5*log(flux_w4) AS intmag_w4_decals,
-2.5*log(flux_g)+2.5*log(1/(flux_ivar_g)^(1/2)+flux_g) AS intmagerr_g_decals,
-2.5*log(flux_r)+2.5*log(1/(flux_ivar_r)^(1/2)+flux_r) AS intmagerr_r_decals,
-2.5*log(flux_z)+2.5*log(1/(flux_ivar_z)^(1/2)+flux_z) AS intmagerr_z_decals,
-2.5*log(flux_w1)+2.5*log(1/(flux_ivar_w1)^(1/2)+flux_w1) AS intmagerr_w1_decals,
-2.5*log(flux_w2)+2.5*log(1/(flux_ivar_w2)^(1/2)+flux_w2) AS intmagerr_w2_decals,
-2.5*log(flux_w3)+2.5*log(1/(flux_ivar_w3)^(1/2)+flux_w3) AS intmagerr_w3_decals,
-2.5*log(flux_w4)+2.5*log(1/(flux_ivar_w4)^(1/2)+flux_w4) AS intmagerr_w4_decals,
22.5-2.5*log(apflux_g[0]) AS apmag1_g_decals,
22.5-2.5*log(apflux_r[0]) AS apmag1_r_decals,
22.5-2.5*log(apflux_z[0]) AS apmag1_z_decals,
-2.5*log(apflux_g[0])+2.5*log(1/(apflux_ivar_g[0])^(1/2)+apflux_g[0]) AS apmag1err_g_decals,
-2.5*log(apflux_r[0])+2.5*log(1/(apflux_ivar_r[0])^(1/2)+apflux_r[0]) AS apmag1err_r_decals,
-2.5*log(apflux_z[0])+2.5*log(1/(apflux_ivar_z[0])^(1/2)+apflux_z[0]) AS apmag1err_z_decals,
22.5-2.5*log(apflux_g[1]) AS apmag2_g_decals,
22.5-2.5*log(apflux_r[1]) AS apmag2_r_decals,
22.5-2.5*log(apflux_z[1]) AS apmag2_z_decals,
-2.5*log(apflux_g[1])+2.5*log(1/(apflux_ivar_g[1])^(1/2)+apflux_g[1]) AS apmag2err_g_decals,
-2.5*log(apflux_r[1])+2.5*log(1/(apflux_ivar_r[1])^(1/2)+apflux_r[1]) AS apmag2err_r_decals,
-2.5*log(apflux_z[1])+2.5*log(1/(apflux_ivar_z[1])^(1/2)+apflux_z[1]) AS apmag2err_z_decals,
22.5-2.5*log(apflux_g[2]) AS apmag3_g_decals,
22.5-2.5*log(apflux_r[2]) AS apmag3_r_decals,
22.5-2.5*log(apflux_z[2]) AS apmag3_z_decals,
-2.5*log(apflux_g[2])+2.5*log(1/(apflux_ivar_g[2])^(1/2)+apflux_g[2]) AS apmag3err_g_decals,
-2.5*log(apflux_r[2])+2.5*log(1/(apflux_ivar_r[2])^(1/2)+apflux_r[2]) AS apmag3err_r_decals,
-2.5*log(apflux_z[2])+2.5*log(1/(apflux_ivar_z[2])^(1/2)+apflux_z[2]) AS apmag3err_z_decals,
22.5-2.5*log(apflux_g[3]) AS apmag4_g_decals,
22.5-2.5*log(apflux_r[3]) AS apmag4_r_decals,
22.5-2.5*log(apflux_z[3]) AS apmag4_z_decals,
-2.5*log(apflux_g[3])+2.5*log(1/(apflux_ivar_g[3])^(1/2)+apflux_g[3]) AS apmag4err_g_decals,
-2.5*log(apflux_r[3])+2.5*log(1/(apflux_ivar_r[3])^(1/2)+apflux_r[3]) AS apmag4err_r_decals,
-2.5*log(apflux_z[3])+2.5*log(1/(apflux_ivar_z[3])^(1/2)+apflux_z[3]) AS apmag4err_z_decals,
22.5-2.5*log(apflux_g[4]) AS apmag5_g_decals,
22.5-2.5*log(apflux_r[4]) AS apmag5_r_decals,
22.5-2.5*log(apflux_z[4]) AS apmag5_z_decals,
-2.5*log(apflux_g[4])+2.5*log(1/(apflux_ivar_g[4])^(1/2)+apflux_g[4]) AS apmag5err_g_decals,
-2.5*log(apflux_r[4])+2.5*log(1/(apflux_ivar_r[4])^(1/2)+apflux_r[4]) AS apmag5err_r_decals,
-2.5*log(apflux_z[4])+2.5*log(1/(apflux_ivar_z[4])^(1/2)+apflux_z[4]) AS apmag5err_z_decals,
22.5-2.5*log(apflux_g[5]) AS apmag6_g_decals,
22.5-2.5*log(apflux_r[5]) AS apmag6_r_decals,
22.5-2.5*log(apflux_z[5]) AS apmag6_z_decals,
-2.5*log(apflux_g[5])+2.5*log(1/(apflux_ivar_g[5])^(1/2)+apflux_g[5]) AS apmag6err_g_decals,
-2.5*log(apflux_r[5])+2.5*log(1/(apflux_ivar_r[5])^(1/2)+apflux_r[5]) AS apmag6err_r_decals,
-2.5*log(apflux_z[5])+2.5*log(1/(apflux_ivar_z[5])^(1/2)+apflux_z[5]) AS apmag6err_z_decals,
22.5-2.5*log(apflux_g[6]) AS apmag7_g_decals,
22.5-2.5*log(apflux_r[6]) AS apmag7_r_decals,
22.5-2.5*log(apflux_z[6]) AS apmag7_z_decals,
-2.5*log(apflux_g[6])+2.5*log(1/(apflux_ivar_g[6])^(1/2)+apflux_g[6]) AS apmag7err_g_decals,
-2.5*log(apflux_r[6])+2.5*log(1/(apflux_ivar_r[6])^(1/2)+apflux_r[6]) AS apmag7err_r_decals,
-2.5*log(apflux_z[6])+2.5*log(1/(apflux_ivar_z[6])^(1/2)+apflux_z[6]) AS apmag7err_z_decals,
22.5-2.5*log(apflux_g[7]) AS apmag8_g_decals,
22.5-2.5*log(apflux_r[7]) AS apmag8_r_decals,
22.5-2.5*log(apflux_z[7]) AS apmag8_z_decals,
-2.5*log(apflux_g[7])+2.5*log(1/(apflux_ivar_g[7])^(1/2)+apflux_g[7]) AS apmag8err_g_decals,
-2.5*log(apflux_r[7])+2.5*log(1/(apflux_ivar_r[7])^(1/2)+apflux_r[7]) AS apmag8err_r_decals,
-2.5*log(apflux_z[7])+2.5*log(1/(apflux_ivar_z[7])^(1/2)+apflux_z[7]) AS apmag8err_z_decals,
shapeexp_r,
shapeexp_r_ivar,
shapeexp_e1,
shapeexp_e1_ivar,
shapeexp_e2,
shapeexp_e2_ivar,
shapedev_r,
shapedev_r_ivar,
shapedev_e1,
shapedev_e1_ivar,
shapedev_e2,
shapedev_e2_ivar,
type,
psfsize_g,
psfsize_r,
psfsize_z,
ref_cat,
ref_id,
gaia_pointsource,
gaia_phot_g_mean_mag,
gaia_phot_g_mean_flux_over_error,
gaia_phot_g_n_obs,
gaia_phot_bp_mean_mag,
gaia_phot_bp_mean_flux_over_error,
gaia_phot_bp_n_obs,
gaia_phot_variable_flag,
gaia_astrometric_excess_noise,
gaia_astrometric_excess_noise_sig,
gaia_astrometric_n_obs_al,
gaia_astrometric_n_good_obs_al,
pmra,
pmdec,
parallax,
pmra_ivar,
pmdec_ivar,
parallax_ivar,
sourceid,
ra_vhs,
dec_vhs,
ypetromag+0.502 AS intmag_Y_vhs,
ypetromagerr AS intmagerr_Y_vhs,
yapermag3+0.502 AS apmag3_Y_vhs,
yapermag3err AS apmag3err_Y_vhs,
yapermag4+0.502 AS apmag4_Y_vhs,
yapermag4err AS apmag4err_Y_vhs,
yapermag6+0.502 AS apmag6_Y_vhs,
yapermag6err AS apmag6err_Y_vhs,
jpetromag+0.916 AS intmag_J_vhs,
jpetromagerr AS intmagerr_J_vhs,
japermag3+0.916 AS apmag3_J_vhs,
japermag3err AS apmag3err_J_vhs,
japermag4+0.916 AS apmag4_J_vhs,
japermag4err AS apmag4err_J_vhs,
japermag6+0.916 AS apmag6_J_vhs,
japermag6err AS apmag6err_J_vhs,
hpetromag+1.366 AS intmag_H_vhs,
hpetromagerr AS intmagerr_H_vhs,
hapermag3+1.366 AS apmag3_H_vhs,
hapermag3err AS apmag3err_H_vhs,
hapermag4+1.366 AS apmag4_H_vhs,
hapermag4err AS apmag4err_H_vhs,
hapermag6+1.366 AS apmag6_H_vhs,
hapermag6err AS apmag6err_H_vhs,
kspetromag+1.827 AS intmag_Ks_vhs,
kspetromagerr AS intmagerr_Ks_vhs,
ksapermag3+1.827 AS apmag3_Ks_vhs,
ksapermag3err AS apmag3err_Ks_vhs,
ksapermag4+1.827 AS apmag4_Ks_vhs,
ksapermag4err AS apmag4err_Ks_vhs,
ksapermag6+1.827 AS apmag6_Ks_vhs,
ksapermag6err AS apmag6err_Ks_vhs,
ra_wise,
dec_wise,
cntr,
w1mpro+2.699 AS intmag_w1_wise,
w1sigmpro AS intmagerr_w1_wise,
w1mag_1+2.699 AS apmag1_w1_wise,
w1sigmag_1 AS apmag1err_w1_wise,
w1mag_2+2.699 AS apmag2_w1_wise,
w1sigmag_2 AS apmag2err_w1_wise,
w1mag_3+2.699 AS apmag3_w1_wise,
w1sigmag_3 AS apmag3err_w1_wise,
w1mag_4+2.699 AS apmag4_w1_wise,
w1sigmag_4 AS apmag4err_w1_wise,
w1mag_5+2.699 AS apmag5_w1_wise,
w1sigmag_5 AS apmag5err_w1_wise,
w1mag_6+2.699 AS apmag6_w1_wise,
w1sigmag_6 AS apmag6err_w1_wise,
w1mag_7+2.699 AS apmag7_w1_wise,
w1sigmag_7 AS apmag7err_w1_wise,
w1mag_8+2.699 AS apmag8_w1_wise,
w1sigmag_8 AS apmag8err_w1_wise,
w2mpro+3.339 AS intmag_w2_wise,
w2sigmpro AS intmagerr_w2_wise,
w2mag_1+3.339 AS apmag1_w2_wise,
w2sigmag_1 AS apmag1err_w2_wise,
w2mag_2+3.339 AS apmag2_w2_wise,
w2sigmag_2 AS apmag2err_w2_wise,
w2mag_3+3.339 AS apmag3_w2_wise,
w2sigmag_3 AS apmag3err_w2_wise,
w2mag_4+3.339 AS apmag4_w2_wise,
w2sigmag_4 AS apmag4err_w2_wise,
w2mag_5+3.339 AS apmag5_w2_wise,
w2sigmag_5 AS apmag5err_w2_wise,
w2mag_6+3.339 AS apmag6_w2_wise,
w2sigmag_6 AS apmag6err_w2_wise,
w2mag_7+3.339 AS apmag7_w2_wise,
w2sigmag_7 AS apmag7err_w2_wise,
w2mag_8+3.339 AS apmag8_w2_wise,
w2sigmag_8 AS apmag8err_w2_wise,
w3mpro+5.174 AS intmag_w3_wise,
w3sigmpro AS intmag_w3err_wise,
w3mag_1+5.174 AS apmag1_w3_wise,
w3sigmag_1 AS apmag1err_w3_wise,
w3mag_2+5.174 AS apmag2_w3_wise,
w3sigmag_2 AS apmag2err_w3_wise,
w3mag_3+5.174 AS apmag3_w3_wise,
w3sigmag_3 AS apmag3err_w3_wise,
w3mag_4+5.174 AS apmag4_w3_wise,
w3sigmag_4 AS apmag4err_w3_wise,
w3mag_5+5.174 AS apmag5_w3_wise,
w3sigmag_5 AS apmag5err_w3_wise,
w3mag_6+5.174 AS apmag6_w3_wise,
w3sigmag_6 AS apmag6err_w3_wise,
w3mag_7+5.174 AS apmag7_w3_wise,
w3sigmag_7 AS apmag7err_w3_wise,
w3mag_8+5.174 AS apmag8_w3_wise,
w3sigmag_8 AS apmag8err_w3_wise,
w4mpro+6.620 AS intmag_w4_wise,
w4sigmpro AS intmagerr_w4_wise,
w4mag_1+6.620 AS apmag1_w4_wise,
w4sigmag_1 AS apmag1err_w4_wise,
w4mag_2+6.620 AS apmag2_w4_wise,
w4sigmag_2 AS apmag2err_w4_wise,
w4mag_3+6.620 AS apmag3_w4_wise,
w4sigmag_3 AS apmag3err_w4_wise,
w4mag_4+6.620 AS apmag4_w4_wise,
w4sigmag_4 AS apmag4err_w4_wise,
w4mag_5+6.620 AS apmag5_w4_wise,
w4sigmag_5 AS apmag5err_w4_wise,
w4mag_6+6.620 AS apmag6_w4_wise,
w4sigmag_6 AS apmag6err_w4_wise,
w4mag_7+6.620 AS apmag7_w4_wise,
w4sigmag_7 AS apmag7err_w4_wise,
w4mag_8+6.620 AS apmag8_w4_wise,
w4sigmag_8 AS apmag8err_w4_wise,
ra_galex,
dec_galex,
objid_galex,
nuv_mag_auto+20.02 AS intmag_NUV_galex,
nuv_magerr_auto AS intmagerr_NUV_galex,
nuv_kron_radius,
fuv_mag_auto+18.82 AS intmag_FUV_galex,
 fuv_magerr_auto AS intmagerr_FUV_galex,
fuv_kron_radius,
nuv_mag_aper_1+20.02 AS apmag1_NUV_galex,
nuv_magerr_aper_1 AS apmag1err_NUV_galex,
nuv_mag_aper_2+20.02 AS apmag2_NUV_galex,
nuv_magerr_aper_2 AS apmag2err_NUV_galex,
nuv_mag_aper_3+20.02 AS apmag3_NUV_galex,
nuv_magerr_aper_3 AS apmag3err_NUV_galex,
nuv_mag_aper_4+20.02 AS apmag4_NUV_galex,
nuv_magerr_aper_4 AS apmag4err_NUV_galex,
nuv_mag_aper_5+20.02 AS apmag5_NUV_galex,
nuv_magerr_aper_5 AS apmag5err_NUV_galex,
nuv_mag_aper_6+20.02 AS apmag6_NUV_galex,
nuv_magerr_aper_6 AS apmag6err_NUV_galex,
nuv_mag_aper_7+20.02 AS apmag7_NUV_galex,
nuv_magerr_aper_7 AS apmag7err_NUV_galex,
fuv_mag_aper_1+18.82 AS apmag1_FUV_galex,
fuv_magerr_aper_1 AS apmag1err_FUV_galex,
fuv_mag_aper_2+18.82 AS apmag2_FUV_galex,
fuv_magerr_aper_2 AS apmag2err_FUV_galex,
fuv_mag_aper_3+18.82 AS apmag3_FUV_galex,
fuv_magerr_aper_3 AS apmag3err_FUV_galex,
fuv_mag_aper_4+18.82 AS apmag4_FUV_galex,
fuv_magerr_aper_4 AS apmag4err_FUV_galex,
fuv_mag_aper_5+18.82 AS apmag5_FUV_galex,
fuv_magerr_aper_5 AS apmag5err_FUV_galex,
fuv_mag_aper_6+18.82 AS apmag6_FUV_galex,
fuv_magerr_aper_6 AS apmag6err_FUV_galex,
fuv_mag_aper_7+18.82 AS apmag7_FUV_galex,
fuv_magerr_aper_7 AS apmag7err_FUV_galex INTO TABLE full_phot_calibrated FROM full_phot_edited;




