Query data in a related table, such as the user table (user_profile), associated with the ID, to find the record in the user_profile in the User table:
SELECT Count (*) from? User Left Join? User_profile on user.id = user_profile.id where user_profile.id is null
Complex conditions:
SELECT Count (*) from? User Left Join? User_profile on user.id = user_profile.id where user.level> 1 or user_profile.money> 10000