我想知道是否可以计算同一查询中查询产生的记录?
SELECT HousesForRent.City
FROM HousesForRent
WHERE rooms >= 7
SELECT COUNT(rooms) AS seven_or_More
FROM HousesForRent
WHERE rooms >= 7;
我只是设法在另一个SELECT
查询中创建它。
答案 0 :(得分:3)
是的,有可能,您只需要使用OVER
子句:
SELECT HousesForRent.City, COUNT(*) OVER() Total
FROM HousesForRent
WHERE (rooms >=7 );