Mysql group_concat problem
3 answers
First advice: normalize your database tables - the field should only contain one value.
Now the solution for your specific problem: MySQL has a function FIND_IN_SET
that should do what you want:
SELECT marks
FROM marks
WHERE FIND_IN_SET('40', marks)
+1
source to share
Your syntax
SELECT GROUP_CONCAT(marks) AS `i need only 40 int in this column` FROM marks
works correctly. You give a GROUP_CONCAT(marks)
name
i need only 40 int in this column
, so it shows what you are speaking through the syntax.
"Result 40 required"
What does this mean when you are using group_concat and want to write where the labels are 40? Why not use a query like
select * from table_name where marks='40'
If group_concat is compultion then use
SELECT GROUP_CONCAT(marks) AS `i need only 40 int in this column` FROM marks where marks='40'
0
source to share