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.
表works(emNo, comNo, salary)。
works(emNo, comNo, salary)
对于这些行中的每一行,我可以使用“从作品 emNo 中选择不同的 comNo”来获得不同的 comNo ". Suppose it gives me a column with 5 rows. How do I count "?
". Suppose it gives me a column with 5 rows. How do I count "
您可以使用GROUP BY聚合每种类型的comNo.
GROUP BY
comNo
SELECT comNo, count(emNo) FROM works GROUP BY comNo
这将返回每个不同值的一行comNo以及每组的记录数。
演示:http ://www.sqlfiddle.com/#!2/4f5df/1