The title doesn’t quite capture what I mean, and this may be a duplicate.
Here’s the long version: given a guest’s name, their registration date, and their checkout date, how do I generate one row for each day that they were a guest?
Ex: Bob checks in 7/14 and leaves 7/17. I want
('Bob', 7/14), ('Bob', 7/15), ('Bob', 7/16), ('Bob', 7/17)
as my result.
Thanks!
I would argue that for this specific purpose the below query is about as efficient as using a dedicated lookup table.
Results:
Presumably you’ll need this as a set, not for a single member, so here is a way to adapt this technique:
Results:
As @Dems pointed out, this could be simplified to: