Jump to content

What does || mean in SQL?


Recommended Posts

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 by markuswinter
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...