Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to group concate the numeric values in MYsql?
Posted
Comments
Herman<T>.Instance 21-Jul-11 6:43am    
how to concat? Do you mean if the values are 3,4 and 5 it returns 345 or 12?

1 solution

What is the problem? If you have a table like this:

SQL
table
id     description     qty
1      a                1
2      b                2
3      a                3
4      b                4


and you used a query like this

SQL
SELECT description, Group_Concat(qty) FROM table WHERE description = a;


then you would get these results

a 1,3

You should provide more info so we can help you more specifically.
 
Share this answer
 
Comments
sacraj 21-Jul-11 9:05am    
sid admno
1 s1
2 s2
3 s3

how to select studentid with group concat where admno in(s1,s2,s3)

the expected output is 1,2,3
help me with mysql query
Wayne Gaylard 21-Jul-11 9:17am    
You can just use SELECT GROUP_CONCAT(sid) FROM table WHERE admno IN (1,2,3); and that should work fine, with the result you wanted (doesn't make any sense to me, however). Hope that helps

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900