search

Home  >  Q&A  >  body text

How to use mysql statement to determine time problem, please help me

For example:

I created a table A, which created the name and time fields

name is used to record the name and time to record the birthday

In my time There is A whose birthday is 2020-10-28, and today is 2020-10-25. There are still 3 days left. If it is less than 30 days, then record it, and then query other ones until the query is completed, and then put the ones that meet the conditions Output it. Guys, how should I do this? I beg you

隔壁老刘隔壁老刘1491 days ago1201

reply all(1)I'll reply

  • 灭绝师太

    灭绝师太2020-11-09 10:19:33

    1. Query the ID and time fields in the database, compare them with the current time, and push the data IDs greater than 3 days into a new array. (The data can be placed in redis, and a scheduled task can be used to reduce database query pressure); 2. Directly obtain the result set, loop through it, and kick out data older than 30 days.

    reply
    0
  • Cancelreply