def build_from_clause(sources):
    """Given a list of table names, connects them with JOINs"""

    from_clause = [sources[0]]
    for join_to in sources[1:]:
        from_clause.append('JOIN {} ON ({}. = {}.)'.format(join_to, sources[0],
                                                           join_to))
    return '\n'.join(from_clause)