-1
SQL查詢:SQL:更新數據透視表
SELECT id,mti,[24] AS nii,mid,tid,[63-D9] AS TxnType,[63-DB] AS batchStatus ,
[39] AS respondCode,[61] AS batchNumber, uploadStatus
FROM (SELECT e.id,m.capDateTime,mti,procCode,mid,tid,uploadStatus,txnDate,txnTime,fieldNumber,fieldData FROM dbo.iso_fields e
JOIN dbo.iso_main m ON e.id = m.id) a PIVOT (MAX(fieldData) FOR fieldNumber IN
([0],[1],[2],[3],[5],[6],[7],[8],[9],[10],[12],[13],[14],[15],[16],[17],[18],[19],[20], [21],[22],[23],[24],[25],[26],[27],[28],[29],[30],
[31],[32],[33],[34],[35],[36],[39],[40], [41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[51],[52],[53],[54],[55],[56],[57],[58],[59],[60],
[61],[63],[64],[63-D9],[63-DB]))PIV
我試着去更新例如表:
UPDATE PIV SET batchStatus = 'C'
SELECT id,mti,[24] AS nii,mid,tid,[63-D9] AS TxnType,[63-DB] AS batchStatus ,
[39] AS respondCode,[61] AS batchNumber, uploadStatus
FROM (SELECT e.id,m.capDateTime,mti,procCode,mid,tid,uploadStatus,txnDate,txnTime,fieldNumber,fieldData FROM dbo.iso_fields e
JOIN dbo.iso_main m ON e.id = m.id) a PIVOT (MAX(fieldData) FOR fieldNumber IN
([0],[1],[2],[3],[5],[6],[7],[8],[9],[10],[12],[13],[14],[15],[16],[17],[18],[19],[20], [21],[22],[23],[24],[25],[26],[27],[28],[29],[30],
[31],[32],[33],[34],[35],[36],[39],[40], [41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[51],[52],[53],[54],[55],[56],[57],[58],[59],[60],
[61],[63],[64],[63-D9],[63-DB]))PIV
WHERE nii = '0000'
Im相當肯定是不正確的語法和IM在如此可怕的數據透視表的
您正在使用哪些DBMS? 「SQL」是一種查詢語言,而不是特定DBMS產品的名稱(另外:您的示例查詢是無效的標準SQL) –