cancel
Showing results for 
Search instead for 
Did you mean: 

DELETE with JOIN

Former Member
3,463

I am using ultralitej database on android application and i need to delete rows with negative ID that exists in the same table with positive ID and same Code column. This sql executes without error in MSSql server but raises an error here: Syntax error near FROM at offset 10

DELETE r FROM Remote as r, Remote as r1 WHERE r.ID < 0 AND r.Code = r1.Code AND r1.ID > 0

Is there anything specific about delete with join in ultrealitej ? I tried with a subquery but got another error: Row has changed since last read -- operation canceled

DELETE FROM Remote WHERE  ID < 0 AND  
EXISTS (SELECT * FROM Remote rReal WHERE  rReal.ID > 0 AND rReal.Code = Remote.Code)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The subquery worked.. i cannot explain why that error appeard, but now is working

Answers (1)

Answers (1)

VolkerBarth
Contributor
0 Kudos

Can't tell why the EXISTS subquery does not work as expected, however, the "DELETE with a table-list syntax" seems unsupported by UltraLite.

That's easily noticable if you compare the DELETE syntax for SQL Anywhere (confine synax 2 which does allow a table-list, just like MS SQL) and for UltraLite.