
SELECT TOP 20
TMPPO.PurchaseOrder ,
TMPPO.LineItem ,
ASLD.SignatureDate ,
ASLD.SignatureTime ,
ASLD.Operator ,
ASLD.Variable ,
ASLD.VariableDesc ,
ASLD.VarNumericValue
FROM #POAMENDMENTS TMPPO
LEFT OUTER JOIN [SysproCompanyR].[dbo].[AdmSignatureLogDet] ASLD ON TMPPO.TransactionId = ASLD.TransactionId
AND TMPPO.SignatureDate = ASLD.SignatureDate
AND TMPPO.SignatureTime = ASLD.SignatureTime
WHERE YEAR(TMPPO.SignatureDate) = 2013
AND MONTH(TMPPO.SignatureDate) = 08
AND VariableDesc IN ( 'Previous foreign price', 'Previous price',
'Foreign price', 'Price' )
ORDER BY PurchaseOrder ,
LineItem
I have the following table but don't want to return the records as per below.
Under the column heading Variable Desc I have Foreign Price, Previous foreign pirce, previous price and price I would like to make these as headings the replace Variable, Variable Desc and VarNumberic.
So e.g. for the first line would be
Purchase Order LineItem SignatureDate SignatureTime Operator PrevFPrice FPrice PrevPrice Price
002074 0001 2013-02-23 9523598 UPOFA0 19.68 21.51 19.68 21.51
004931 0001 2013-08-09 7485253 PVWYK0 980.00 840.00 980.00 840.00
Sorry but is difficult to put sample data here no idea how to...
Is this possible?
@Bummi it provides me data like this, why is Purchase Order 005331 duplicating so many times when in essence according to the original sample data it changed only 2 times according to date and time
