Re: Trying to fetch records only if preceded by at least another one

2019-10-25 Thread Michael Lewis
On Fri, Oct 25, 2019 at 2:20 PM Alexander Farber wrote: > Thank you Michael - > > On Fri, Oct 25, 2019 at 7:28 PM Michael Lewis wrote: > >> But it prints too many records: all moves cross-multiplied with each >>> other. >>> >>> As if I have forgotten to add 1 more condition to the JOIN LATERAL >

Re: Trying to fetch records only if preceded by at least another one

2019-10-25 Thread Alexander Farber
Thank you Michael - On Fri, Oct 25, 2019 at 7:28 PM Michael Lewis wrote: > But it prints too many records: all moves cross-multiplied with each other. >> >> As if I have forgotten to add 1 more condition to the JOIN LATERAL >> > > LIMIT 1 inside your lateral should resolve that. Personally, I'd

Re: Trying to fetch records only if preceded by at least another one

2019-10-25 Thread Michael Lewis
> > But it prints too many records: all moves cross-multiplied with each other. > > As if I have forgotten to add 1 more condition to the JOIN LATERAL > LIMIT 1 inside your lateral should resolve that. Personally, I'd move that condition to EXISTS condition inside WHERE clause instead. Just a styl

Trying to fetch records only if preceded by at least another one

2019-10-25 Thread Alexander Farber
Good evening, for a word game hosted on PostgreSQL 10 I try to find interesting player moves (high score or played all 7 tiles) and generate a "puzzle" images out of them (example: https://imgur.com/a/StnXqoR ) The moves are stored in: words_ru=> \d words_moves