如果两列与MySQL不匹配,则删除一行

时间:2018-08-22 20:37:22

标签: mysql

SELECT follower_id, poster_id, recipient_id
FROM followers
INNER JOIN post on followed_id = poster_id
WHERE follower_id = 1;

returns:

+-------------+-----------+--------------+
| follower_id | poster_id | recipient_id |
+-------------+-----------+--------------+
|           1 |         2 |            2 |
|           1 |         2 |            2 |
|           1 |         2 |            2 |
|           1 |         2 |            7 |
+-------------+-----------+--------------+

有没有办法省去poster_id!= receiver_id的行?我需要前三行...

2 个答案:

答案 0 :(得分:0)

如果只需要在结果中省略它们,请在V_ID子句中使用888运算符。

AND

答案 1 :(得分:0)

public class SecurePropertyAccessor extends ReflectivePropertyAccessor {

    @Override
    public  boolean canRead(EvaluationContext context, Object target, String name) {
        boolean canRead = // Add your own logic as needed
        return canRead;
    }
}