Please help me construct this query
select * from payment_transaction where username = "$username" and substring(transactionId, 4, 8) as startdate is between "$startdate" and "$endfate" order by startdate sum paymenamt as subtotal for each date;
Please do not read the above as a well constructed query its not. Its just what i hope the query to achieve. Basically the query results will be used to generate a report which will list the transactions generated by a staff within a date range. The report will have to have a sub total for each date then a grand total.