Clear database column from time to time

Asked

Viewed 43 times

-5

Is it possible to clear the database column at the end of the day/week/month? I have a code that records the number of calls an employee makes. For example: at the end of the day he performed 17 visits, so the next day the value should return to zero. However, the value of the week cannot be zero, because he made 17 calls the day before. And this should happen for the month as well. Grateful from now on!

  • 1

    Which database?

  • MYSQL, but I think I got another way to do it. I thank you anyway!

  • If you’re willing to do this, you’re probably trying to solve a problem in an unconventional way. This type of information (number of appointments in a day), must be originated by the sum of the records of appointments made by an attendant in the day and not by the value placed in a column and then be zeroed.

1 answer

1


If you already register this data, why delete it? You can do this using Rigger (you need to detail which bank you are using). But it’s server processing waste.

If it’s just by displaying the data to the user, you can solve it easily in two steps:

1) Change the table to record the current date when the save is done

2) Perform a BD query using Where (and filter by day, week and month parameters as appropriate).

  • 1

    Really, I hadn’t thought about it. Thank you very much bro :D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.