I have a PHP, MySQL project in which reporting section I want to show three functions of the database in the reporting section:
- Fetch data from the database table
receipts
- Sum column
r_amount
by user - Filter data between two dates
Thanks
I have a PHP, MySQL project in which reporting section I want to show three functions of the database in the reporting section:
receipts
r_amount
by userThanks
SELECT user, SUM(r_amount)
FROM receipts
WHERE date BETWEEN ? AND ?
GROUP BY user
Hello Welcome to Stack Overflow
You should search before posting anything, there are many threads/posts regarding this question
select * from reciepts where date BETWEEN '" . $from_date . "' AND '" . $to_date . "'
order by id desc
select sum(r_amount) from reciepts where date BETWEEN '" . $from_date . "' AND '" . $to_date . "' order by id desc
1.data between 2 dates
SELECT items,... FROM receipts
WHERE From_date >= 'date1'
AND To_date <= 'date2'
2.sum between 2 dates
SELECT sum(item)as r_amount FROM receipts
WHERE From_date >= 'date1'
AND To_date <= 'date2'