我有这个 MySQL 查询(工作)
第一个查询:
SELECT id
FROM users
WHERE publisher_set = '1'
AND publisher_status = '1'
AND publisher_content != ''
AND publisher_amount != '0'
AND publisher_now < publisher_max
AND EXISTS (
SELECT *
FROM user_counter
WHERE users.id = user_counter.publisher_id
)
上面的 MySQL 查询是从两个表中查找用户 id
现在我想再次使用第二个 MySQL 查询进行比较(工作)
第二个查询:
SELECT users.id, publisher_amount, publisher_now, publisher_max, counter
FROM users
INNER JOIN user_counter ON users.id = user_counter.publisher_id
WHERE no = 08123456789
AND counter < publisher_amount
但是当我像这样加入所有查询时:
SELECT id
FROM users
WHERE publisher_set = '1'
AND publisher_status = '1'
AND publisher_content != ''
AND publisher_amount != '0'
AND publisher_now < publisher_max
AND EXISTS (
SELECT *
FROM user_counter
WHERE users.id = user_counter.publisher_id
)
AND (
SELECT users.id, publisher_amount, publisher_now, publisher_max, counter
FROM users
INNER JOIN user_counter ON users.id = user_counter.publisher_id
WHERE no =08123456789
AND counter < publisher_amount
)
我收到此错误:
操作数应包含 1 列
然后,我尝试使用 1 列,但结果不是我想要的。
我的问题是如何加入第一个和第二个查询?并且不会产生错误。
我已经尝试过用谷歌搜索它,经过多次“尝试和错误”,这是我可以使查询工作的最远距离。