I have first output in the image and I want to convert it to second output in image using LINQ Core. Is there and direct unpivot option in LINQ.
I am able to write the code for PIVOT and UNPIVOT in SQL. But not able to find a way to do the same in LINQ.
I have below SQL query for the same :
SELECT ResourceName,
max(ENText)as ENText,
max(FRText)as FRText,
max(ZHText)as ZHText,
max(DEText)as DEText,
max(ITText)as ITText,
max(JAText)as JAText,
max(PTText)as PTText,
max([PT-BRText]) as [PT-BRText],
max(RUText) as RUText,
max(ESText) as ESText,
max(SVText) as SVText into #temp
FROM
GenericLanguageTranslation
PIVOT
(
max(Translation) FOR LanguageID IN (
ENText,
ZHText,
FRText,
DEText,
ITText,
JAText,
PTText,
[PT-BRText],
RUText,
ESText,
SVText)
) AS Tab2
group by ResourceName
order by 1
select * from #temp
SELECT NEWID() as Id,ResourceName, [LanguageID],[Translation]-- into #GenericLanguageTranslation
FROM #temp
UNPIVOT
(
[Translation]
FOR [LanguageID] IN
(
ENText,
ZHText,
FRText,
DEText,
ITText,
JAText,
PTText,
[PT-BRText],
RUText,
ESText,
SVText
)
) AS UnpivotTranslation