如果不显示结果,请检查SQL查询中是否存在其他表中的记录

I currently have two tables - opportunities & applications

Basically I am wondering the best way in my query below to check the applications table and check if the user has already made an application request. If the column user_id in applications = '$userID' and opportunity_id = o.id and status ! = 2 - then show the results?

Is there a way to do it via SQLQuery rather than php?

SELECT * FROM opportunities o
LEFT JOIN companies ON companies.owner_id = o.owner_id
WHERE (FIND_IN_SET(o.languages,'$user->languages')
OR o.opportunity_sales_methods IN ($user->sellingmethods)
OR o.opportunity_our_industry IN ($user->want2sell)
) OR o.opportunity_seller_type LIKE '%$user->sellertype%'
GROUP BY o.id

This is the general idea

select c1, c2, c3
from t1
where not exists (select t2.c5 from t2 where t1.c4 = t2.c5)

you will need to apply this to your tables and fields. You will not need to group by id, since it is a primary key, therefore unique.