SELECT
A.[Date]
,A.Loc
,A.IDText
,C.IDText
,B.IDValue
FROM
(SELECT
[Date]
,Loc
,IDKey
,Field
,TranNo
,IDText
,IDValue
FROM
MyTable
WHERE IDKey = 919) A
INNER JOIN
(SELECT
[Date]
,Loc
,IDKey
,Field
,TranNo
,IDText
,IDValue
FROM
MyTable
WHERE IDKey = 921) B
ON A.[Date] = B.[Date] AND A.TranNo = B.TranNo
INNER JOIN
(SELECT
[Date]
,Loc
,IDKey
,Field
,TranNo
,IDText
,IDValue
FROM
MyTable
WHERE IDKey = 922) C
ON A.[Date] = C.[Date] AND A.TranNo = C.TranNo
|