人妖在线一区,国产日韩欧美一区二区综合在线,国产啪精品视频网站免费,欧美内射深插日本少妇

新聞動(dòng)態(tài)

SQL 合并多行記錄的相同字段值

發(fā)布日期:2022-01-30 10:39 | 文章來(lái)源:源碼中國(guó)

2.從數(shù)據(jù)庫(kù)中一次讀取數(shù)據(jù)到一張表中返回并顯示到UI層。說(shuō)起來(lái)誰(shuí)都想這么做,但是以前太笨,沒(méi)有去研究這個(gè),今天因?yàn)閿?shù)據(jù)量較大的原因,讓我不得不想些其他辦法來(lái)提高點(diǎn)效率。
Google~hk一下,果真有答案,然后依葫蘆畫瓢,自己寫了一個(gè)
目的是獲取不定量的符合條件的兼職記錄,并將每個(gè)兼職參與項(xiàng)目情況記錄到某幾個(gè)字段當(dāng)中,然后一次返回Table
復(fù)制代碼 代碼如下:

Create function Fn_GetJobListByPID--創(chuàng)建自定義函數(shù)獲取指定兼職參與的所有項(xiàng)目編號(hào)及項(xiàng)目數(shù)量
(
@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

引用
復(fù)制代碼 代碼如下:

--...........................
--做過(guò)項(xiàng)目
left join (select Jobs,ParttimerID,TotalCount From Fn_GetJobListByPID(@ParttimerID)) as j1
on p.ParttimerID=j1.ParttimerID
--在做項(xiàng)目
left join (select CurJobs,ParttimerID,CurCount From Fn_GetCurJobsByPID(@ParttimerID)) as j2
on p.ParttimerID=j2.ParttimerID
where p.ParttimerID=@ParttimerID

國(guó)外穩(wěn)定服務(wù)器

版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。

相關(guān)文章

實(shí)時(shí)開(kāi)通

自選配置、實(shí)時(shí)開(kāi)通

免備案

全球線路精選!

全天候客戶服務(wù)

7x24全年不間斷在線

專屬顧問(wèn)服務(wù)

1對(duì)1客戶咨詢顧問(wèn)

在線
客服

在線客服:7*24小時(shí)在線

客服
熱線

400-630-3752
7*24小時(shí)客服服務(wù)熱線

關(guān)注
微信

關(guān)注官方微信
頂部