1

I have this query

SELECT Stations.Instance
    ,stations.ID
    ,stations.Name
    ,Stations.Lat
    ,Stations.Lon
    ,(
        SELECT GROUP_CONCAT(Line SEPARATOR ';')
        FROM transportData.timeTables
        WHERE timeTables.Station = stations.ID
        GROUP BY timeTables.Station
        ) AS 'Lines'
    ,(
        SELECT GROUP_CONCAT(Weekdays SEPARATOR ';')
        FROM transportData.timeTables
        WHERE timeTables.Station = stations.ID
        GROUP BY timeTables.Station
        ) AS 'Weekdays'
    ,(
        SELECT GROUP_CONCAT(Weekends SEPARATOR ';')
        FROM transportData.timeTables
        WHERE timeTables.Station = stations.ID
        GROUP BY timeTables.Station
        ) AS 'Weekends'
FROM `Stations`
INNER JOIN transportData.stations ON stations.Lat = Stations.Lat
    AND stations.Lon = Stations.Lon
WHERE Instance = '$instance'

that is supposed to return in the Weekdays column a list of Weekdays that have the same Station column as the ID column of transportData.stations. Same goes for Weekends.

My issue here is the fact that these columns are usually large, about 2000 characters, and with this query, I could concatenate up to about 10 of these, so that's a lot of characters.

The query above works, but returns the Weekdays and Weekends with a maximum length of 1024, which is not at all enough.

How can I tell MariaDB that I want the result in more than 1024 characters?

Shadow
  • 33,525
  • 10
  • 51
  • 64
George Lazu
  • 301
  • 3
  • 10
  • 1
    Unrelated: Consider LEFT JOIN and conditional aggregation instead of those correlated sub-queries. – jarlh Feb 26 '18 at 12:03
  • What datatype are your `transportData.timeTables.Weekdays` and `transportData.timeTables.Weekends` columns? – eggyal Feb 26 '18 at 12:03

1 Answers1

1

You can extend the group_concat limit changing the my.ini

group_concat_max_len = 10000
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107