SELECT AVG(goals1) FROM matches
WHERE cid='1'
(SELECT AVG(goals2) FROM matches
WHERE cid='2')
;
答案 0 :(得分:1)
SELECT AVG(goals1) AvgCid1, (SELECT AVG(goals2) FROM matches WHERE cid='2') AvgCid2
FROM matches
WHERE cid='1'
答案 1 :(得分:0)
在这些语句之间添加UNION
:
SELECT AVG(goals1) FROM matches
WHERE cid='1'
UNION
SELECT AVG(goals2) FROM matches
WHERE cid='2'
您可能还需要为列命名。
答案 2 :(得分:0)
这个怎么样?
SELECT * FROM
(SELECT AVG(goals1) AS goals1 FROM matches WHERE cid='1') t1
full outer join
(SELECT AVG(goals2) AS goals2 FROM matches WHERE cid='2') t2
ON t1.goals1 <> t2.goals2;