:SELECT *

:FROM
  match INNER JOIN featureloc AS hitloc ON (hitloc.feature_id = match.feature_id)
  INNER JOIN feature AS hitfeature ON (hitfeature.feature_id = hitloc.srcfeature_id)
  INNER JOIN featureloc AS qloc ON (qloc.feature_id = match.feature_id)
  INNER JOIN feature AS qfeature ON (qfeature.feature_id = qloc.srcfeature_id)

:WHERE   hitfeature.name = &name&
   AND
  qloc.rank = 0
   AND
  hitloc.rank = 1
   
:USE NESTING (set (match(hitloc(hitfeature))(qloc(qfeature))))

// -------------------------------------------

schema: chado
desc: gets the downstream area of an alignment
see_also:
