简体   繁体   English

在 MySQL 中组合 3 列

[英]Combining 3 columns in MySQL

I want to combine 3 columns, for example:我想合并 3 列,例如:

id  c_id    choice_a    choice_b        choice_c

1   1    Agra College   RBS College     St Jhones
2   2    Agra College   RBS College     St Jhones
3   3    Agra College   St Jhones       RBS College
4   6    Dyalbagh       Agra College    mahrana college

How would I approach this problem?我将如何解决这个问题?

select CONCAT_WS(' ',col1 , col2,col3) from table从表中选择 CONCAT_WS(' ',col1 , col2,col3)

In CONCAT_WS() first argument is separator by which u want to separate columns values在 CONCAT_WS() 中,第一个参数是您想要分隔列值的分隔符

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM