SELECT * INTO #Loc1
FROM LocaleStringResource
Where LanguageId = 1
SELECT * INTO #Loc2
FROM LocaleStringResource
Where LanguageId = 3
SELECT Loc1.Id, Loc1.LanguageId, Loc1.ResourceName, Loc1.ResourceValue,
Loc2.Id, Loc2.LanguageId, Loc2.ResourceName, Loc2.ResourceValue
FROM #Loc1 AS Loc1 INNER JOIN
#Loc2 AS Loc2 ON Loc1.ResourceName = Loc2.ResourceName
更新: 我有一個名爲 - LocaleStringResource的表。 列:Id,LanguageId,ResourceName,ResourceValue,如何將linq中的這個sql腳本轉換爲實體?
假設我的系統中有2種語言。
Id Language
1 English
3 Bangla
Id LanguageId ResourceName ResourceValue
1 1 Admin.Address Address
2 1 Admin.Phone Phone
51 3 Admin.Address SpAddress
51 3 Admin.Phone SpPhone
通過ResourceName我得到什麼值是選擇語言。所以從管理頁面我想通過ResourceName查看什麼是兩種語言的ResourceValue。
所以我需要一個返回類似這樣的結果集。
ResourceName ResourceValue As EnglishText ResourceValue As SpanishText
Admin.Address Address SpAddress
Admin.Phone Phone SpPhone
如果你需要一些幫助,你需要顯示你已經嘗試過的東西。 –