database: Advantage Sybase 11Come scrivere un'istruzione SQL DELETE con un'istruzione SELECT nella clausola WHERE?
Sulla mia ricerca per normalizzare i dati, sto cercando di eliminare i risultati che ottengo da questa SELECT
dichiarazione:
SELECT tableA.entitynum
FROM tableA q
INNER JOIN tableB u on (u.qlabel = q.entityrole AND u.fieldnum = q.fieldnum)
WHERE (LENGTH(q.memotext) NOT IN (8,9,10)
OR q.memotext NOT LIKE '%/%/%')
AND (u.FldFormat = 'Date')
;
Questa è la dichiarazione DELETE
sono venuto su con:
DELETE FROM tableA
WHERE (SELECT q.entitynum
FROM tableA q
INNER JOIN tableB u on (u.qlabel = q.entityrole AND u.fieldnum = q.fieldnum)
WHERE (LENGTH(q.memotext) NOT IN (8,9,10)
OR q.memotext NOT LIKE '%/%/%')
AND (u.FldFormat = 'Date'))
;
io continuo ottengo questo errore quando provo a fare funzionare questa dichiarazione:
ERROR IN SCRIPT: poQuery: Error 7200: AQE Error: State = S0000; NativeError = 2124;
[iAnywhere Solutions][Advantage SQL Engine]Invalid operand for operator: = Boolean value
cannot be operated with non-Boolean value.
Ho anche provato questa affermazione:
DELETE FROM tableA
INNER JOIN tableB u on (u.qlabel = tableA.entityrole AND u.fieldnum = tableA.fieldnum)
WHERE (LENGTH(q.memotext) NOT IN (8,9,10)
OR tableA.memotext NOT LIKE '%/%/%')
AND (u.FldFormat = 'Date')
;
che si traduce in:
ERROR IN SCRIPT: poQuery: Error 7200: AQE Error: State = 42000; NativeError = 2117;
[iAnywhere Solutions][Advantage SQL Engine] Unexpected token: INNER -- Expecting semicolon.
-- Location of error in the SQL statement is: 23 (line: 2 column: 1)
Qualcuno mi potrebbe aiutare a costruire correttamente una query DELETE che si tradurrà in dati corretti di essere rimosso?
peggiore delle ipotesi - si può creare una tabella temporanea, SELEZIONA in quella tabella temporanea, fare la tua eliminare unendo la tabella temporanea, quindi droping la tabella temporanea? –