Thursday, November 29, 2012

group_concat in mysql example

group_concat in mysql example

CITY_ID CITY_NAME STATE_NAME
1 Bhopal MP
2 Indore MP
3 Delhi DELHI
4 Allahabad UP


SELECT group_concat(concat(`city_id`,'@@', `city_name`,'@@', `state_name`),'###') as city FROM `city`


Result

1@@Bhopal@@MP###,2@@Indore@@MP###,3@@Delhi@@DELHI###,4@@Allahabad@@UP###

No comments:

Post a Comment

If you Satisfied , Please Leave a comment