
One of my application need update the days when it have set the days inside the records. It was because sometimes user need extend the expired date to following number of days.
With the SQL statement it would be simple to complete the task.
UPDATE table
SET expired_date = DATE_ADD(expired,INTERVAL 7 DAY)
WHERE id = 1;
The above example only work on
DATE or
DATETIME field types. Remember it was
day not
days
Posted by
chevrons in
MySQL

It have few ways to get multiple counts with one SQL Query. But, it also will return more then one row records to user, and also the total count wouldn’t appear if it no inside the records.
In the same time, user need did few times loop and if else conditions to get the results. It will slow down the application performance and give developer more job to completed the job.
In here, I have a better way to process multiple counts with one SQL Query and it just return one row record only.
Let’s see below example how the SQL look like:
Posted by
chevrons in
MySQL