modified query to get tables to only grab base tables