Skip to content
Advertisement

How to compare 2 columns of 2 different tables on Mysql

I did something like this with PHP and it works.

JavaScript

My question is how to do the same with one sql statement, instead of writing 3 different and doing the array_diff/implode thing.

Unfortunately I have limited sql knowledge but I’m pretty sure it’s possible, I think with JOIN but after 2 hours still can’t find how. :/

Advertisement

Answer

You can use sub-query. The query will be like below.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement