At the moment, I have something like this ...
SELECT SUM(a.PaidSingle) AS PaidSingle,
DATE_FORMAT(a.TimeIn, '%a') AS weekDay
FROM Attendance AS a JOIN MemberDetail AS m ON m.id = a.MemberID
WHERE m.CardNumber = '$cardNo'
AND WEEK(a.TimeIn, 0) = WEEK(NOW(),0)
GROUP BY weekDay
ORDER BY a.TimeIn
But after me it was understood when I wrote that this would happen both in previous years and this year.
I just wanted to say and year = this year, but, of course, in the week starting in December and ending in January, I get only half an hour.
What is the best way to do this in MySQL or should I use a PHP based solution?
source
share