Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2312382
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: Mysql/postgreSQL

2011-12-14 23:05:04

Basically the question is how to get from this:

id string 1 A 1 B 2 C

to this:

id string 1 A B 2 C

SELECT id, GROUP_CONCAT(string SEPARATOR ' ') FROM table GROUP BY id;

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat


阅读(1257) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~