这是我的问题:
我已经有了这个问题:
SELECT
CPV.ID as CheckPointValueID,
CP.Code as Point_Code,
TT.Medium as Point_Description,
[TEXT_TRANSLATION_ANS].[Medium] AS Value,
CASE CPH.Checked WHEN '0' THEN 'FALSE' WHEN '1' THEN 'TRUE' END as Checked,
CLCP.SequenceNo as SequenceNo,
CPH.Value_ as Additional_Information,
EMP.Name as Checked_By,
CPH.AnsweredOn as Checked_On
FROM CHECK_LIST_HISTORY CLH
JOIN CHECK_POINT_HISTORY CPH on CLH.ID = CPH.CheckListHistoryID
JOIN CHECK_POINT_VALUE CPV on CPH.CheckPointID = CPV.CheckPointID
JOIN CHECK_POINT CP on CPH.CheckPointID = CP.ID
JOIN CHECK_LIST_CHECK_POINT CLCP on CP.ID = CLCP.CheckPointID
LEFT JOIN EMPLOYEE EMP on CPH.EmployeeID = EMP.ID
JOIN TEXT_TRANSLATION TT on CP.TextID = TT.TextID and TT.LanguageID = LanguageID
JOIN [TEXT_TRANSLATION] [TEXT_TRANSLATION_ANS] ON CPV.AnswerTextID = [TEXT_TRANSLATION_ANS].[TextID] AND [TEXT_TRANSLATION_ANS].[LanguageID] = TT.LanguageID
JOIN [TEXT_TRANSLATION] [TEXT_TRANSLATION_RES] ON CPV.ResponseTextID = [TEXT_TRANSLATION_RES].[TextID] AND [TEXT_TRANSLATION_RES].[LanguageID] = TT.LanguageID
WHERE CLH.WipOrderNo = 103 and CLH.WipOrderType=26
返回此表:
我需要提供具有相同Point_Code或SequenceNo的行,并在列Value中的一个单元格中显示不同的值。
具有Point_Code的行如:MachineIsRunning和SequenceNo:20将具有:
Point_Code Point_Description Value
MachineIsRunning Machine is Running Machine Is Running - Answer, Machine is stopped
不要查看ID和其他列。
我尝试使用GROUP BY或COALESACE制作它,但它没有用。我没有更多的想法如何做到这一点。
HELP!