MySQL 请求有两列条件

MySQL request with a condition on two columns

我在 MySQL 数据库中有这个 table :

table1

User_id   type
2          1
1          2    
2          3

我只想获取类型 2 或 3 用户的 users_id,只有当他们的 user_id 值不同于类型 =1 的 user_id 时。

希望你明白了,你可以帮助我,我不知道用什么来解决他的问题。

I want to get the users_id of users with type 2 or 3 only when their user_id value is different from the user_id with the type=1.

SQL

可以写的差不多
SELECT * 
FROM users
WHERE type IN (2,3) and user_id NOT IN (SELECT user_id FROM users WHERE type = 1)
SELECT 
user_id,
type,
FROM
yourTable
WHERE type IN (2,3)
AND user_id NOT IN (
   SELECT
   user_id
   FROM yourTable
   WHERE type = 1)