13 July, 2012

GROUP_CONCAT() Function in MYSQL

GROUP_CONCAT() is one the most essential function over many areas of software development.The basic purpose of this function is to concatinate all records/rows/tuples of a single column/field into a single string.MYSQL library provides huge amount of function with huge requirement of clients.

Suppose:-

select vchDay from m_days_list

A column has these following records


After use GROUP_CONCAT() the output like below-



Query :-
select GROUP_CONCAT(vchDay) from m_days_list

GROUP_CONCAT() not only working on single column , but it also working on multiple column/field.And the results are also similar as single column.It gives higher operating value than GROUP BY clause.

select GROUP_CONCAT(vchDay,vchMonth) from m_days_list

Output:-

FridayJanuary,MondayFebruary,SaturDayMarch     .................... Like this .


No comments:

Post a Comment