我有一个有效的SQL语句8 _1 Q. ^5 w8 c6 m' l6 b1 @; }
SELECT * FROM eventsTable WHERE columnName='Business'我想把这个添加到子查询中… ( e, z9 u! a' ~- K2 DCOUNT(Business) AS row_count我该怎么办?) B8 u* m2 a* h3 L# v% b
4 O. e+ H( F+ T. ` 解决方案: 3 c9 O1 Y. o5 ?$ {, i 这可能是最简单的方法,尽管它不是最漂亮的方法:5 A( n0 T( D/ N% G; S3 P$ ^
SELECT *, (SELECT Count(*) FROM eventsTable WHERE columnName = 'Business') as RowCount FROM eventsTable WHERE columnName = 'Business'也可以使用,不用 group by # U k1 c, B8 r: \8 ASELECT *,COUNT(*) OVER () as RowCount FROM eventsTables WHERE columnName = 'Business