This is my query
SELECT c.car_name,
MAX(DATEDIFF(r.return_date, r.pickup_date)) + 1 AS No_of_Days,
DENSE_RANK() OVER (ORDER BY MAX(DATEDIFF(r.return_date, r.pickup_date)) + 1 DESC) as Dense_Rank
FROM cars AS c
JOIN rentals AS r ON c.car_id = r.car_id
WHERE MONTH(pickup_date) = 5
GROUP BY c.car_id
ORDER BY Dense_Rank;
Error is
ERROR 1064 (42000) at line 80: You have an error in your SQL syntax;
check the m anual that corresponds to your MySQL server version for
the right syntax to use near (ORDER BY
MAX(DATEDIFF(r.return_date,r.pickup_date))+1 DESC) as Dense_Rank from
at line 2
2
Answers
is this query will result the same error?
Try the following query