Ordering When Concatenating exercise in aggregation section has no solution #288
There's no solution for the "Ordering When Concatenating" exercise in the aggregation section (section 6). I can't quite work out a complete solution which reports the answer on one line.
SELECT group_concat(personal || ' ' || family, ' ') FROM Person order by family;
which produces the wrong order:
William Dyer Frank Pabodie Anderson Lake Valentina Roerich Frank Danforth
SELECT personal || ' ' || family FROM Person order by family;
produces the right order but uses multiple lines.
Does anyone have the correct solution to this?
The text was updated successfully, but these errors were encountered:
One of our students yesterday pointed out that it could be done via
Removes the requirement to order the results in final aggregation exercise on concatenating. There was no solution for this exercise and solving it required using sub queries which haven't been discussed until now. I've simplified it to no need the results to be ordered, but instead to require a colon character as a separator. This way there's still a reason to use group_concat. This has been previously discussed in bugs swcarpentry#158, swcarpentry#255 and swcarpentry#288. A previous solution was proposed and then retracted in pull request swcarpentry#210.