Figured out the Querying from database