suresh_kamrushi Posted January 14, 2011 Share Posted January 14, 2011 I have a table like below: CREATE TABLE IF NOT EXISTS `country` ( `id` int(11) NOT NULL, `state` varchar(10) collate latin1_general_ci NOT NULL, `country` varchar(50) collate latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; Values as under: id State Country 1 1,2,3 India State values are store in country table as commo separated. Now I want to retrieve all state in a country. And all state id should be replace by state name. Is that can achieve in one query? Thanks in Advance [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/224408-need-to-separate-out-commo-separted-values-in-mysql/ Share on other sites More sharing options...
fenway Posted January 14, 2011 Share Posted January 14, 2011 Not easily -- that's why comma-separated lists are a bad idea. Link to comment https://forums.phpfreaks.com/topic/224408-need-to-separate-out-commo-separted-values-in-mysql/#findComment-1159446 Share on other sites More sharing options...
suresh_kamrushi Posted January 17, 2011 Author Share Posted January 17, 2011 is there any body to solve this problem!!! Link to comment https://forums.phpfreaks.com/topic/224408-need-to-separate-out-commo-separted-values-in-mysql/#findComment-1160644 Share on other sites More sharing options...
fenway Posted January 19, 2011 Share Posted January 19, 2011 The "solution" is to store it different -- I already to you that. Otherwise, you'll have to explode() everything in php. Link to comment https://forums.phpfreaks.com/topic/224408-need-to-separate-out-commo-separted-values-in-mysql/#findComment-1162145 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.