I recently discovered the limitations of GROUP_CONCAT. I have a query with 482 results. I need to get a CSV of all 482 IDs. When I run GROUP_CONCAT, it can only get 147 at a time (with ,10
) left over:
SELECT GROUP_CONCAT(id)
FROM account
WHERE parent_account_id = 707070
AND id != parent_account_id;
I've tried using LIMIT
:
SELECT GROUP_CONCAT(id)
FROM account
WHERE parent_account_id = 707070
AND id != parent_account_id
LIMIT 0, 100;
But this doesn't work when I try to get the next 100:
SELECT GROUP_CONCAT(id)
FROM account
WHERE parent_account_id = 707070
AND id != parent_account_id
LIMIT 100, 100;
Are there any other SQL tricks for getting a long CSV without me having to export the results to a file and then use regex to replace newlines with commas?