mysql  列转行处理

 

 mysql  列转行处理mysql  列转行处理

 

 

 mysql  列转行处理

 

 

 

 

CREATE TABLE `table1` (
  `id` int(11) DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into table1 values(1,'yang,zheng,song');
insert into table1 values(2,'zhao,qian,sun');
insert into table1 values(3,'zhou,wu');

mysql  列转行处理

SELECT a.id,
substring_index( substring_index( a.name, ',', b.help_topic_id + 1 ), ',',- 1 ) name
FROM table1 a
JOIN mysql.help_topic b ON b.help_topic_id < ( length( a.name ) - length( REPLACE ( a.name, ',', '' ) ) + 1 ) 
ORDER BY a.id


mysql  列转行处理

 

相关文章:

  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-08-07
  • 2021-04-15
相关资源
相似解决方案