Notice (8): file_put_contents(): Write of 270 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 284 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2558 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 4079 of 4085 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2757 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2073 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2097 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2073 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2097 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
SQL合并多行记录的相同字段值 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >>

SQL合并多行记录的相同字段值

Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]
Notice: file_put_contents() [function.file-put-contents]: Write of 2421 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2445 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
">
Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2421 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2445 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
2022-09-23 16:51:51 转载来源: 网络整理/侵权必删

1.从数据库中先查询符合条件的记录,存放于一个DataTable中,在使用c#等开始遍历这张表,利用DataRow中的主键,再去读取相应的符合条件的多条记录,合并这些第二次读取到的记录内容,返回给前面的这个DataRow数据行。这样做没有错,但是如果数据量大,我们可能面临无数次的打开断开数据库链接,速度效率将会很低

1.从数据库中先查询符合条件的记录,存放于一个DataTable中,在使用c#等开始遍历这张表,利用DataRow中的主键,再去读取相应的符合条件的多条记录,合并这些第二次读取到的记录内容,返回给前面的这个DataRow数据行。这样做没有错,但是如果数据量大,我们可能面临无数次的打开断开数据库链接,速度效率将会很低。
2.从数据库中一次读取数据到一张表中返回并显示到UI层。说起来谁都想这么做,但是以前太笨,没有去研究这个,今天因为数据量较大的原因,让我不得不想些其他办法来提高点效率。
Google~hk一下,果真有答案,然后依葫芦画瓢,自己写了一个
目的是获取不定量的符合条件的兼职记录,并将每个兼职参与项目情况记录到某几个字段当中,然后一次返回Table
复制代码 代码如下:

Create function Fn_GetJobListByPID--创建自定义函数获取指定兼职参与的所有项目编号及项目数量
(
@ParttimerID int
)
returns @t table(Jobs varchar(5000),ParttimerID int,TotalCount int)
as
begin
declare @sql varchar(5000),@TotalCount int
set @sql=''
set @TotalCount=0
select @sql=@sql+j.JobNo+'-'+j.JobWave+' ',@TotalCount=@TotalCount+1
from ONJB_JobApplication a,ONJB_Jobs j
where a.ParttimerID=@ParttimerID
and a.Result='V'
and a.JobID=j.JobID
insert @t values(@sql,@ParttimerID,@TotalCount)
return
end

引用
复制代码 代码如下:

--...........................
--做过项目
left join (select Jobs,ParttimerID,TotalCount From Fn_GetJobListByPID(@ParttimerID)) as j1
on p.ParttimerID=j1.ParttimerID
--在做项目
left join (select CurJobs,ParttimerID,CurCount From Fn_GetCurJobsByPID(@ParttimerID)) as j2
on p.ParttimerID=j2.ParttimerID
where p.ParttimerID=@ParttimerID

标签: SQL 合并 多行 记录 相同 字段


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2025 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持