added support to select queries with where and order by clause