Jump to content

Need to separate out commo separted values in MYSQL


suresh_kamrushi

Recommended Posts

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.