LIMIT ignored in query with GROUP_CONCAT LIMIT ignored in query with GROUP_CONCAT sql sql

LIMIT ignored in query with GROUP_CONCAT

The LIMIT clause limits the number of rows in the final result set, not the number of rows used to construct the string in the GROUP_CONCAT. Since your query returns only one row in the final result the LIMIT has no effect.

You can solve your issue by constructing a subquery with LIMIT 3, then in an outer query apply GROUP_CONCAT to the result of that subquery.

Your query is not working as you intended for the reasons @Mark Byers outlined in the other answer. You may want to try the following instead:

SELECT  GROUP_CONCAT(`value` ORDER BY `order` ASC SEPARATOR ', ') FROM    (           SELECT    `value`, `order`           FROM      slud_data            LEFT JOIN slud_types ON slud_types.type_id = slud_data.type_id            WHERE     slud_data.product_id = 18 AND value != '' AND display = 0            LIMIT     3        ) a;

An example of Mark Byers idea:

SELECT GROUP_CONCAT(id, '|', name) FROM (SELECT id, nameFROM usersLIMIT 3) inner