hi,

i have a table which have code col and data col.the code and data occur repeated no of time.
so i run query like

SELECT code, COUNT( code ) AS no_of_times
FROM testing_table
GROUP BY code
ORDER BY code

which give no of time code is repeated in the table but i also wants the data corresponding to code to be concated and shown in different col.

i need query for this

regards
rajan

You can use the group_concat() function:

SELECT code, COUNT( code ), group_concat(data) AS no_of_times
FROM testing_table
GROUP BY code
ORDER BY code
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.