Yesterday, I wanted to perform a SQL INTERSECT operation on a MySQL 5.x database. I'm pretty used to work with Oracle, and Oracle is totally familiar with this
( SELECT foo FROM bar1 ) INTERSECT ( SELECT foo FROM bar2 )
Unfortunately, MySQL doesn't know this syntax. This is my workaround:
SELECT foo FROM bar1 WHERE foo IN ( SELECT foo FROM bar2 )
Add new comment