view sale db query