执行代码:
SELECT sr2.CLASSIFICATIONID, COUNT (sr2.CLASSIFICATIONID) FROM SR sr2
GROUP BY (CLASSIFICATIONID)
ORDER BY COUNT (sr2.CLASSIFICATIONID) desc;
一切都很完美。
尝试在没有任何列选择的情况下加入额外的表:
SELECT sr2.CLASSIFICATIONID, COUNT (sr2.CLASSIFICATIONID) FROM SR sr2
LEFT JOIN CLASSSTRUCTURE cl on cl.CLASSSTRUCTUREID=sr2.CLASSIFICATIONID -- joining
GROUP BY (CLASSIFICATIONID)
ORDER BY COUNT (sr2.CLASSIFICATIONID) desc;
我做错了什么?
答案 0 :(得分:0)
哦,我只需要GROUP BY中的id
GROUP BY (sr2.CLASSIFICATIONID)