多行数据转化为一行
来源:互联网 发布:.ga域名是哪的 编辑:程序博客网 时间:2024/06/06 07:03
写一Function
alter function f_hb(@id int)
returns varchar(8000)
as
begin
declare @str varchar(8000)
set @str = ' '
select @str = @str + ',' + cast(stime as varchar) from s where tid = @id
set @str = right(@str , len(@str) - 1)
return(@str)
End
其中 stime 是你需要相加 的字段
tid 是你的外键
s 为你的次表
select t.tid , max(ss) from s,
(select distinct tid ,dbo.f_hb(t.tid) as ss from t) t
where s.tid = t.tid
group by t.tid
t 为主表
- 多行数据转化为一行!
- 多行数据转化为一行
- Oracle多行数据显示为一行
- oracle10g 多行数据合并为一行
- 将多行数据合并为一行
- mysql多行数据合并为一行
- MS-SQL 多行数据合并为一行
- T_SQL 将一列多行数据合并为一行
- T_SQL 将一列多行数据合并为一行
- T_SQL 将一列多行数据合并为一行
- T_SQL 将一列多行数据合并为一行
- SQL将一列多行数据转换为一行
- :一条SQL实现将多行数据并为一行显示
- PHP里数据库查询结果为一行数据和多行数据的时候的处理
- 利用Oracle分析函数实现多行数据合并为一行
- 利用Oracle分析函数实现多行数据合并为一行
- SQL Server中将多行数据拼接为一行数据(一个字符串)
- SQL Server中将多行数据拼接为一行数据(一个字符串)
- 深入研究Servlet线程安全性问题
- zoj 2281 Way to Freedom(最短路加强版)
- jms 的基本概念
- 了凡四训
- 锁的代价
- 多行数据转化为一行
- 软件各种版本代号详解
- tty 设备
- oracle DBA常用的sql语句
- android binder 讲解(二)
- Xvid参数介绍[GMC]
- 《Win 7二十一:让你精通Windows 7的21个专题》
- IHttpModel中得到session
- android binder 讲解(三)