edited query for orders.