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 * from frequency where (...) UNION SELECT * from frequency where (...)
我如何计算上面返回了多少结果?
使用COUNT()带有子查询的函数
COUNT()
SELECT COUNT(*) AS Row_Counts FROM ( SELECT * from frequency where (...) UNION SELECT * from frequency where (...) ) A
为什么UNION?如果你结合WHERE子句,你可以这样计算:
UNION
WHERE
SELECT COUNT(*) FROM frequency WHERE (...) OR (...)