So here is my SQL
SET group_concat_max_len = 18446744073709551615;
SELECT
`event`.title AS 'Event Title',
eventitem.startdate AS 'Start Date',
`get_unique_items` (
CONVERT (
group_concat(eventstage.title SEPARATOR ',') USING utf8
)
) AS 'Stage',
`get_unique_items` (
CONVERT (
group_concat(artists.artistname SEPARATOR ',') USING utf8
)
) AS 'Artist Name'
FROM
eventstage
INNER JOIN `event` ON eventstage.eventid = `event`.eventid
INNER JOIN eventitem ON eventitem.eventstageid = eventstage.eventstageid
INNER JOIN artists ON eventitem.artistid = artists.artistid
GROUP BY
eventstage.eventid,
eventitem.eventstageid,
eventitem.startdate
The get_unique_items
does as the name suggests. It removes any duplicates.
Now each record has an eventitem
has a ranking
field. Each artist has a ranking, with 0 denoting the highest and higher numbers denoting a lower ranking.
How can manipulate the SQL so in the results, under the 'Artist Name' column, I get a list of artists in ranking order?
I don't believe it to be the same as MySQL: Sort GROUP_CONCAT values since I'm not using the function on the ranking field Thanks