To retrieve particular data set I had to use a subquery in a select query which is a group by expression as below:
SELECT SUM(b.RESERVEDROOMS) AS "Reserved Rooms",
(SELECT country
FROM location
WHERE location_id = b.location_id) AS "Country"
FROM bookingsRevenue b,
location l
WHERE b.location_id = l.location_id
GROUP BY b.location_id
It works fine and correct data are retrieved but when I try to create a view from it, following error is shown. Could you please help me to resolve this.
[Error] Execution (21: 74): ORA-00979: not a GROUP BY expression