if value is already in the second table do not select

profile_id is varchar

SELECT profile_id
            FROM a_messages

where profile_id is NOT in profiles
so profiles.profile_id does not exist

because if the value is already profiles table, there is no need to use it
Who is Participating?
vr6rConnect With a Mentor Commented:
SELECT a_messages.profile_id
FROM a_messages
LEFT JOIN profiles on profiles.profile_id = a_messages.profile_id
WHERE profiles.profile_id IS NULL

Open in new window

rgb192Author Commented:
thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.