Syntax Problem using UNION

  • Hi,

    I am sure I must be doing something stupid but I am having a problem using a UNION within a SELECT statement, I am getting the following error 'Incorrect syntax near the keyword 'WHERE' and I cannot see what I am doing wrong (see statement below).

    SELECT findings, packingdets from

    (SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS 

    UNION

    SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS_V1) WHERE SV_CASEREF = 'P4476#70211'

    The similar statement appears to work OK against Oracle !!

    Anyone have any ideas?

    Any help welcomed... thanks

    Chris

     

  • SELECT findings, packingdets from

    (SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS 

    UNION

    SELECT findings, packingdets, SV_CASEREF FROM RECEIVEGOODS_V1) a WHERE SV_CASEREF = 'P4476#70211'

  • Excellent, thank you for your assistance.

    Am I right in thinking that the 'a' is aliasing the primary SELECT?

  • table alias

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply