How to find missing rows (dates) in a mysql table?

前端 未结 3 1913
故里飘歌
故里飘歌 2020-12-11 07:45

I have tried several topics like this one: How to find missing data rows using SQL? here, but I couldn\'t make it work in my situation.

I have a table named po

3条回答
  •  再見小時候
    2020-12-11 08:43

    You could automatically enter an empty post each time (end of day) with null titles, null contents but actual date. Then, if the user wants to add a post for a previous day, display all the posts with null titles and contents and update the one he selects.

    This shouldn't be a space problem, not if they write more than they miss. For instance, if they write for 4 days and miss 1.

    Also, you would run a script and delete entries with null titles, null contents AND date older than X days. If they haven't added the missing post for X days, they probably will never do.

    I apologize if my solution is trivial / too abstract.

提交回复
热议问题