how to fetch data from two tables using single query