i have a table with 2 colums, id and date.
supposing i have some holes (IE i do not have stored some days), which is the best way to retrive one row for each day of a certain period ?
I thought to do a LEFT JOIN with a generated date table, but i was wondering it is a better way to do this.
If not, which is a good way to generate a time table ?
Thank you!
A generated data table is not a bad idea: the data is fixed, and you can take advantage of indexes, which you couldn’t do if you persisted the data in memory (well, you could wit temporary tables, which is still using a generated data table).
Here’s an example: