Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SELECT x,y,SUM(f)-SUM(g) FROM a,b WHERE a.x = b.x GROUP BY SUM(f)-SUM(g) HAVING SUM(f)-SUM(g)>1
GROUP BY x を試してみるとうまくいきますが、どうすれば GROUP BY SUM(f)-SUM(g) にできますか??
集計列でグループ化する必要はありません。必要なのは
SELECT x,y,SUM(f)-SUM(g) FROM a,b WHERE a.x = b.x GROUP BY x,y HAVING SUM(f)-SUM(g)>1