Reputation: 11
i cant understand what is wrong with this query. Someone can explain to me where is the error. Thank you so much
SELECT
WF1.GUID,
WF1.COD_FONTE,
WF1.NOME_FILE,
VW.COD_STEP_PRECEDENTE,
VW.COD_STEP_ATTUALE AS WF1
FROM
MONITOR.FILE_WORKFLOW
INNER JOIN MONITOR.VW_JOB_FONTE_STEP AS VW ON WF1.COD_FONTE = VW.COD_FONTE
AND VW.JOB_KEY = 'FLATTENER'
WHERE
WF1.GUID = '5f58d00b6102ab20a8d5c83f'
AND WF1.ESITO = 'OK'
AND WF1.COD_STEP = VW.COD_STEP_PRECEDENTE
AND NOT EXISTS (
SELECT
1
FROM
MONITOR.FILE_WORKFLOW AS WF2
WHERE
WF2.GUID = '5f58d00b6102ab20'
AND WF2.ESITO = 'OK'
AND WF2.COD_STEP = VW.COD_STEP_ATTUALE
AND WF1.IDE_FILE_WORKFLOW_PARENT = WF2.IDE_FILE_WORKFLOW_PARENT
)
Upvotes: 0
Views: 175
Reputation: 4129
I'm sure you're using the table alias wrong
VW.COD_STEP_ATTUALE AS WF1 <-- WF1 is a column alias
FROM
MONITOR.FILE_WORKFLOW
INNER JOIN MONITOR.VW_JOB_FONTE_STEP AS VW
ON WF1.COD_FONTE = VW.COD_FONTE <-- here you are using WF1 as a table alias
I assume this will fix the problem
VW.COD_STEP_ATTUALE
FROM
MONITOR.FILE_WORKFLOW WF1 <-- alias name goes here
Upvotes: 1