first way of doing select query