SELECT areasymbol AS Area_symbol, m.mukey AS MUKEY, musym AS Map_unit_symbol, muname AS Map_unit_name,
comppct_r AS Component_percentage, compname AS Component_name, compkind AS Component_kind,
drainagecl AS Drainage_class, hzname AS Horizon_name, hzdept_r AS Top_depth, hzdepb_r AS Bottom_depth,
om_r AS Organic_matter, sandtotal_r AS Sand, silttotal_r AS Silt, claytotal_r AS Clay,
(SELECT top 1 texture FROM chorizon
LEFT OUTER JOIN chtexturegrp ON chorizon.chkey = chtexturegrp.chkey
WHERE rvindicator = 'yes' AND chorizon.chkey = h.chkey ORDER BY rvindicator DESC) AS Texture,
(SELECT TOP 1 copmgrp.pmgroupname
FROM copmgrp
WHERE c.cokey = copmgrp.cokey AND copmgrp.rvindicator='yes') AS Parent_material,
(SELECT TOP 1 cogeomordesc.geomfname
FROM cogeomordesc
WHERE c.cokey = cogeomordesc.cokey AND cogeomordesc.rvindicator='yes' AND cogeomordesc.geomftname = 'Landform') AS Landform
FROM legend AS l
INNER JOIN mapunit AS m ON l.lkey = m.lkey
INNER JOIN component AS c ON m.mukey = c.mukey AND Majcompflag='yes' AND compname LIKE
'clarksville'
LEFT OUTER JOIN chorizon AS h ON h.cokey = c.cokey
WHERE hzdept_r = 0 AND l.areasymbol LIKE
'MO%'
AND c.cokey = (SELECT TOP 1 component.cokey FROM component WHERE component.mukey=m.mukey
ORDER BY component.comppct_r DESC)
ORDER BY compname, comppct_r DESC, areasymbol