def compound_inv_query(query, rel, dst):
    """
    Create a compound inverse query, similar to
    :meth:``compound_fw_query`` but only selects the
    source nodes given a destination node.

    :param query: The SQL subquery.
    :param rel: The relation.
    :param dst: The destination node.
    """
    smt = 'SELECT src FROM %s WHERE src IN (%s) AND dst = ?'
    return smt % (rel, query), (dst,)