selecting more that 2 tables based on 1 subquery find an error