Retrieve missing dates from database via MySQL

后端 未结 2 1688
感情败类
感情败类 2021-01-23 00:43

So I have a table where I collect data for the jobs that I do. Each time I create a job I assign it a date. The problem with this is the days I don\'t have jobs aren\'t stored i

2条回答
  •  长发绾君心
    2021-01-23 01:43

    There's no reasonable way to do this using pure SQL, on MySQL at least, without creating a table with every date ever devised. Your best option is to alter the application that's using the results of that query to fill in the holes itself. Rather than graphing only the values it received, construct its own set of values with a simple loop; counting up one day at a time, filling in values from the query wherever they're available.

提交回复
热议问题