SELECT sa.saversion, sa.saverest, l.lkey, mu.mukey, c.cokey, ch.chkey, l.areasymbol, l.areaname, mu.musym , mu.muname, mu.muacres, c.compname , c.comppct_r,localphase , slope_r , slopelenusle_r , albedodry_r , desgnmaster, hzname, hzdept_r, hzdepb_r, hzdepb_r-hzdept_r AS thick, claytotal_r, silttotal_r, sandtotal_r, sandvc_r, sandco_r, sandmed_r, sandfine_r, sandvf_r, texture, (SELECT CASE WHEN SUM(cf.fragvol_r) IS NULL THEN '0' ELSE CAST(SUM(cf.fragvol_r) AS VARCHAR) END FROM chfrags cf WHERE cf.chkey = ch.chkey) AS fragvol, sieveno10_r, fraggt10_r, frag3to10_r, kffact, dbthirdbar_r, dbovendry_r, ksat_r, ph1to1h2o_r, wthirdbar_r, wfifteenbar_r, awc_l,awc_r, om_r, ec_r, caco3_r, cec7_r, ecec_r
FROM legend AS l
INNER JOIN mapunit AS mu ON mu.lkey = l.lkey
INNER JOIN sacatalog AS sa ON sa.areasymbol = l.areasymbol AND l.areasymbol LIKE
'OH003'
INNER JOIN component AS c ON c.mukey = mu.mukey AND compkind != 'miscellaneous area'
INNER JOIN chorizon AS ch ON ch.cokey = c.cokey
INNER JOIN chtexturegrp AS ct ON ch.chkey=ct.chkey AND ct.rvindicator = 'yes'
ORDER BY areasymbol, musym, comppct_r DESC, hzdept_r