I am attempting a SQL query and getting this error:
ERROR: syntax error at or near "rental_date"
LINE 4: select I.store_id,EXTRACT(MONTH FROM TIMESTAMP rental_date) ...
This is my code:
select
store_id, Month_Name, max(RentOrder) as maximum_order
from
(select
I.store_id, EXTRACT(MONTH FROM TIMESTAMP rental_date) as Month_Name,
count(rental_id) as RentOrder
from
Rental R
inner join
Inventory I on R.inventory_id = I.inventory_id
group by
I.store_id, EXTRACT(MONTH FROM TIMESTAMP rental_date) ) as T
group by
store_id, Month_Name
I have checked the names of the variables thoroughly matching my database.
However, it is still throwing the syntax issue. Assistance would be appreciated to solve this!