On Mon, Mar 19, 2018 at 1:54 PM, Alexander Farber <
alexander.far...@gmail.com> wrote:
>
> I've come up with the following query, wonder if you meant something
> similar -
>
> http://sqlfiddle.com/#!17/4ef8b/48
>
> WITH cte1 AS (
> SELECT
> mid,
> STRING_AGG(x->>'letter', '') AS tiles
> FR
Thank you, David -
On Fri, Mar 16, 2018 at 5:40 PM, David G. Johnston <
david.g.johns...@gmail.com> wrote:
> On Fri, Mar 16, 2018 at 9:10 AM, Alexander Farber <
> alexander.far...@gmail.com> wrote:
>
>> SELECT mid,
>>
> (SELECT string_agg(tiles, '; ') FROM tiles WHERE ta.mid = moves.mid) AS
> mi
On Fri, Mar 16, 2018 at 9:10 AM, Alexander Farber <
alexander.far...@gmail.com> wrote:
>
> But you say that "tiles" and "word (score)" are unrelated and this does
> not seem true to me:
>
> For each move id aka "mid" there is a JSON value, describing how the
> player played the letter tiles.
> An
Hi David -
On Fri, Mar 16, 2018 at 4:40 PM, David G. Johnston <
david.g.johns...@gmail.com> wrote:
> First reaction is to ARRAY_AGG(DISTINCT x) and then write a function that
> converts that array into a string by extracting 'letter' from each cell in
> the array.
>
> Thinking it over a bit you
On Fri, Mar 16, 2018 at 7:17 AM, Alexander Farber <
alexander.far...@gmail.com> wrote:
> And I can not change the query to: STRING_AGG(DISTINCT x->>'letter', '')
> AS tiles,
>
> Because for example in the last move with mid=6 the player Bob had played
> 2 tiles, both with letter-value "P" and has