在sql server中的合并语句可以用xml path
详见http://www.cnblogs.com/codeyu/archive/2010/05/25/1743474.html
而oracle的合并可以用 listagg配合within group
select * from (
select groupvalue,max(sendtime) as
sendtime,
listagg(content) within group (order by sort) as content from
messages a
group by groupvalue
) order by sendtime desc
还可以用这一句
select wm_concat(content) from messages
合并短信的内容