I've a small piece of code that doesn't like me referencing a table directly but when I use an alias it's fine:
SELECT ret.RP_ID, SHORT_DESCR, RP_RP_ID_ARTL
FROM RETL_PRDS ret
WHERE ret.RP_ID = TEMP_SCODES.RP_ID OR ret.RP_RP_ID_ARTL = TEMP_SCODES.RP_ID
ORDER BY ret.RP_ID;
doesn't work
but
SELECT ret.RP_ID, SHORT_DESCR, RP_RP_ID_ARTL
FROM RETL_PRDS ret, TEMP_SCODES sco
WHERE ret.RP_ID = sco.RP_ID OR ret.RP_RP_ID_ARTL = sco.RP_ID
ORDER BY ret.RP_ID;
does. I know using an alias is better but any idea why this isn't working, I've an update statement as well where I can't use an alias and have to use seperate select statements to compare and it would be easier just to reference the table directly.
Any ideas?
Cheers,
Pete
SELECT ret.RP_ID, SHORT_DESCR, RP_RP_ID_ARTL
FROM RETL_PRDS ret
WHERE ret.RP_ID = TEMP_SCODES.RP_ID OR ret.RP_RP_ID_ARTL = TEMP_SCODES.RP_ID
ORDER BY ret.RP_ID;
doesn't work
but
SELECT ret.RP_ID, SHORT_DESCR, RP_RP_ID_ARTL
FROM RETL_PRDS ret, TEMP_SCODES sco
WHERE ret.RP_ID = sco.RP_ID OR ret.RP_RP_ID_ARTL = sco.RP_ID
ORDER BY ret.RP_ID;
does. I know using an alias is better but any idea why this isn't working, I've an update statement as well where I can't use an alias and have to use seperate select statements to compare and it would be easier just to reference the table directly.
Any ideas?
Cheers,
Pete