>>>>> "Rich" == Rich Shepard <rshepard(at)appl-ecosys(dot)com> writes:
Rich> Will probably try DISTINCT ON, too, if that makes it simpler or Rich> faster.
You want LATERAL.
-- Andrew (irc:RhodiumToad)