I have a table in MySQL Database which has the details of the user inputs.Each user will be able to input their details 3 times a day.I will have a target value for each input.By the end of the day, I want to add and calculate the entries of each inputs and try to match it with each target and try to fill a column accordingly as "TARGET ACHIEVED" or "TARGET MISSED" for each input.
For eg. My SQL Query is:
INSERT INTO employee_details(enquiry,retail, collection,booking, evaluation, test_drive,
home_visit, name, date,time,taget_status)
values ('$enquiry', '$retail','$collection', '$booking', '$evaluation', '$test_drive',
'$home_visit', '$user_name', CURDATE(), '$time');
So,when the user inputs the value of enquiry 3 times a day, then I want to calculate the sum of the 3 inputs for the column "enquiry" and check if it has achieved the target i.e. 10. If the sum is equal to 10, then the column "target_status" should be updated as "TARGET ACHIEVED" or "TARGET MISSED" accordingly. And I want to do the calculation everday by the End of the day.
Can anyone please suggest a solution on how to proceed.