由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 请教一个有关SQL concat的问题
相关主题
SQL Server - delcare variable dynamicallyT-SQL 问题
问一个SQL Server的问题求助:如何ColumName 作为变量放入query
anyone can help on this query, thanks!error of executing SQL query of string concatenation (转载
Special character in insert valuesoracle中如何查询已建立的表结构
sql question一个sql问题:怎样实现 (((a1*10)+a2)*10+a3)*10 ... (转载)
Question about T-SQL请教大牛一道有趣的SQL题
纪录查找问题SQL find distinct values in large table
SQL请教...怎么写这样的distribution listmysql challenge
相关话题的讨论汇总
话题: sql话题: value话题: mysql话题: any话题: concat
进入Database版参与讨论
1 (共1页)
r******h
发帖数: 809
1
id value
1 a
1 b
1 c
want something like
id value
1 a,b,c
Any single SQL statement can do this? (MySQL doesn't count...)
Thanks.
z********y
发帖数: 14
2
try this one
Create function [dbo].[myFun]
(@P1 int)
returns varchar(1000)
as
begin
declare @aa varchar(1000);
set @aa ='';
select @aa = [value] + ',' + @aa from myTable
where id = @P1 order by [value] desc;
return @aa;
end
select top 1 [id] , [dbo].[myFun]([id]) from myTable where [id] = 1;

【在 r******h 的大作中提到】
: id value
: 1 a
: 1 b
: 1 c
: want something like
: id value
: 1 a,b,c
: Any single SQL statement can do this? (MySQL doesn't count...)
: Thanks.

B*****g
发帖数: 34098
3
sql server solution. http://www.mitbbs.com/article_t/Database/31141059.html
need oracle? kao gu yourself.

【在 r******h 的大作中提到】
: id value
: 1 a
: 1 b
: 1 c
: want something like
: id value
: 1 a,b,c
: Any single SQL statement can do this? (MySQL doesn't count...)
: Thanks.

s******s
发帖数: 508
4
google stragg if you need Oracle solution.

【在 B*****g 的大作中提到】
: sql server solution. http://www.mitbbs.com/article_t/Database/31141059.html
: need oracle? kao gu yourself.

y********o
发帖数: 2565
5
Use for xml path. Read the following thread, you only need to read the
first two posts.
http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_thread/thread/d7931fb07e1533a3/2f030d214ad6b52d?hl=en&lnk=gst&q=row+into+one+cell#2f030d214ad6b52d

【在 r******h 的大作中提到】
: id value
: 1 a
: 1 b
: 1 c
: want something like
: id value
: 1 a,b,c
: Any single SQL statement can do this? (MySQL doesn't count...)
: Thanks.

1 (共1页)
进入Database版参与讨论
相关主题
mysql challengesql question
新手求助: 学那个DATABASE软件好呢?Question about T-SQL
zz: Oracle推出免费数据库产品纪录查找问题
问个基础的理论问题----数据库的基本差异SQL请教...怎么写这样的distribution list
SQL Server - delcare variable dynamicallyT-SQL 问题
问一个SQL Server的问题求助:如何ColumName 作为变量放入query
anyone can help on this query, thanks!error of executing SQL query of string concatenation (转载
Special character in insert valuesoracle中如何查询已建立的表结构
相关话题的讨论汇总
话题: sql话题: value话题: mysql话题: any话题: concat