Quoting Mischa <>:
[deleted]
> SELECT People.* FROM People
> JOIN Widths
> ON People.start = today - today % Widths.width
> AND People.width = Widths.width
Yikes! I hit the SEND button one ohnosecend too fast.
(1) You still ALSO have to test:
... AND today between first_date and last_date
(2) On some SQL engines, it makes a different to how the engine can re-order the
nested loops, if you make the index (width,start) instead of (start,width).
Haven't tried on PG8 yet.
--
"Dreams come true, not free."