Search code examples
mysqlgroup-concat

mysql group_concat issue


I just trying to know is this possible the function of MYSQL GROUP_CONCAT to return this type of data. Here is a scenario

SELECT GROUP_CONCAT(marks) AS `i need only 40 int in this column`  FROM marks

when i execute this Query the result will be show like this

enter image description here

Result required 40


Solution

  • Try this:

    select group_concat(m.marks) from 
        ( select distinct marks from marks limit 40 ) m