IS IN (Select statement, 'value', 'value')

I am trying to run the following SQL

DELETE FROM T_ATH_POSHLD WHERE T_ATH_POSHLD.A_INSID IN (SELECT T_ATH_POSHLD.A_INSID FROM T_ATH_POSHLD LEFT JOIN T_ATH_INS ON T_ATH_POSHLD.A_INSID = T_ATH_INS.A_INSID WHERE T_ATH_INS.A_INSCLSCDE1 = 'CASH' AND T_ATH_POSHLD.A_INSID NOT IN (SELECT A_INSID FROM T_ATH_CCY) AND A_ACCID IN (SELECT A_ACCID FROM T_ATH_EXTACC, '1212OEIC', '5667033ZS'))

and in particular, am trying to check whether an ACCID is in a set of values, some coming from a table and two hardcoded. How would I achieve this?

IN (SELECT A_ACCID FROM T_ATH_EXTACC, '1212OEIC', '5667033ZS')

Doesn't work, I get an 'Incorrect Syntax error'.

Thanks

Answers


You need to use UNION to add the 2 hardcoded values to the resultset that you are passing to the in clause.

IN (SELECT A_ACCID FROM T_ATH_EXTACC UNION ALL SELECT '1212OEIC' UNION ALL SELECT '5667033ZS')

Need Your Help

How to call a Windows application from google chrome and firefox?

google-chrome-extension firefox-addon

I want to call a Windows (7/Vista/XP only) application from google chrome or Firefox. I am thinking of making an addon to do this. I can look up the tutorials mentioned here How to make firefox or ...

Page Not Found Error in Header of WordPress Blog

php html wordpress http-status-code-404

I'm working on a WordPress site and a weird thing is happening in the header.