我是一个菜鸟,我正在尝试区分两个查询输出。每个查询都会创建一个列表查询列表>查询B列表。此外,查询B输出是查询A的子集。
查询A:
SELECT first_name, last_name
FROM users
WHERE rating <> '6';
查询B:
SELECT DISTINCT first_name, last_name
FROM users
JOIN mp_positions
ON users.id=mp_positions.user_id
JOIN mps
ON mps.id=mp_positions.mp_id
WHERE mps.status_id = '5';
任何帮助都将不胜感激。
答案 0 :(得分:2)
我会使用this因此
-- It returns rows from Query B which "doesn't exist in" Query A
SELECT DISTINCT first_name, last_name
FROM users
JOIN mp_positions
ON users.id=mp_positions.user_id
JOIN mps
ON mps.id=mp_positions.mp_id
WHERE mps.status_id = '5'
EXCEPT
SELECT first_name, last_name
FROM users
WHERE rating <> '6';
然后
var shape = new Shape();
shape.graphics.beginPath();
shape.graphics.circle(100, 100, 50);
shape.graphics.closePath();
shape.graphics.fillColor(Color.Red);
stage.addChild(shape);
答案 1 :(得分:1)
虽然您可能想尝试这样的事情,但我并不完全确定您的牌桌结构:
SELECT first_name, last_name
FROM users
WHERE rating <> '6'
AND users.id
NOT IN (SELECT DISTINCT first_name, last_name
FROM users
JOIN mp_positions
ON users.id=mp_positions.user_id
JOIN mps ON mps.id=mp_positions.mp_id
WHERE mps.status_id = '5'
);