我试图列出一个表格,其中包含三次以上的数字。如您所见,我是SQL新手。我对SQL的语法和可能性有点不确定。
我试过这个:
SELECT tabel1.nr, count(tabel2.opp)
FROM tabel1
JOIN tabel2 on tabel2.opp = tabel1.opp
WHERE tabel2.opp > 3
ORDER BY tabel2.opp
这是我想弄清楚的想法:
SELECT COUNT(tabel1.key = tabel2.key) as numbers
FROM table1
ORDER BY numbers > 3
答案 0 :(得分:3)
试试这个
SELECT tabel1.nr, count(tabel2.opp)
FROM tabel1
JOIN tabel2 on tabel2.opp = tabel1.opp
GROUP BY tabel1.nr
HAVING count(tabel2.opp) > 3
ORDER BY tabel2.opp