I'm having a question on how to duplicate rows in a table that generates dates between StartDate and EndDate. Actually, I have a same question as this Duplicating records to fill gap between dates in Google BigQuery but with a different type of table.
So, my table looks like this:
╔═══════════╦══════════════╦══════════════╗
║ user_name ║ start_date ║ end_date ║
╠═══════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║
╚═══════════╩══════════════╩══════════════╝
and I would like the output to be like this:
╔═══════════╦══════════════╦══════════════╦══════════════╗
║ user_name ║ start_date ║ end_date ║ date ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║ '2019-07-01' ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║ '2019-07-02' ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║ '2019-07-03' ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║ '2019-07-04' ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ ... ║ ... ║ ... ║ ... ║
╠═══════════╬══════════════╬══════════════╬══════════════╣
║ A ║ '2019-07-01' ║ '2019-07-31' ║ '2019-07-31' ║
╚═══════════╩══════════════╩══════════════╩══════════════╝
How should I put it in a query? Thanks in advance.