I'm relatively new to SQL and am trying to delete all rows in ADDRESS where the ADDRESSID (primary key of ADDRESS) is on multiple rows on table2
DELETE FROM ADDRESS
WHERE ADDRESSID =
(SELECT DISTINCT ADDRESSID
WHERE CUSTOMERARC = 'Y')
I am receiving the message:
DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0811N The result of a scalar fullselect, SELECT INTO statement, or VALUES INTO statement is more than one row. SQLSTATE=21000
Could someone give me a little assistance?
I'd prefer to perform this in "pure SQL" but if I need to open a cursor and process each delete singlely, I can do that. Just looking for the fastest/easiest way to accomplish this.