updated sql query to include all transaction data