markuswinter Posted February 22, 2016 Share Posted February 22, 2016 (edited) Hi all, I just came across the following SQL (aid and fid are two fields in both database tables): delete from Table2 where aid || fid in (select aid || fid from Table1) ; which is much faster than delete from Table2 a where EXISTS( SELECT * FROM table1 b WHERE a.aid=b.aid AND a.fid=b.fid) But what does || mean? Edited February 22, 2016 by markuswinter Link to comment Share on other sites More sharing options...
justsomeguy Posted February 22, 2016 Share Posted February 22, 2016 It usually means a logical OR. I don't think that code is going to do what you want though. It will either delete all records where aid is a non-empty value, or it will delete all records where either aid or fid is non-empty. What it is not going to do is to delete all records from table 2 where either aid or fid is in table1. 1 Link to comment Share on other sites More sharing options...
markuswinter Posted February 29, 2016 Author Share Posted February 29, 2016 Thanks. It's not my SQL, I was just curious what the || meant. But I'll pass it on. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now