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

jQuery ajax json webservice error

c# jquery ajax json web-services

If someone could point out what's wrong here I would certainly appreciate it. I can set a breakpoint in the webmethod and it gets hit, but it always errors out.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.