I'm attempting to write a query that I know is compatible with MySQL to MS Access. This is a programming assignment, so I'm not expecting an answer straight up given to me, but I don't know MS Access' version of SQL well enough. I wrote the MySQL myself, and tested it to be working. That's when I realized that the query needed to work for MS Access instead. So here is the known code:
SELECT `D`.`RENT_NUM`,
`R`.`RENT_DATE`,
`D`.`VID_NUM`,
`M`.`MOVIE_TITLE`,
`D`.`DETAIL_DUEDATE`,
`D`.`DETAIL_RETURNDATE`,
`D`.`DETAIL_FEE`,
`D`.`DETAIL_RETURNDATE` - `D`.`DETAIL_DUEDATE` AS `DAYS_LATE`
FROM `detailrental` AS `D`
JOIN `rental` AS `R` ON `D`.`RENT_NUM` = `R`.`RENT_NUM`
JOIN `video` AS `V` ON `D`.`VID_NUM` = `V`.`VID_NUM`
JOIN `movie` AS `M` ON `V`.`MOVIE_NUM` = `M`.`MOVIE_NUM`
WHERE `D`.`DETAIL_RETURNDATE` - `D`.`DETAIL_DUEDATE` > 0
ORDER BY `R`.`RENT_NUM`, `M`.`MOVIE_TITLE`;
I've been attempting to convert to MS Access SQL, but I still don't get it. Here is the most recent attempt.
SELECT [D].[RENT_NUM],
[R].[RENT_DATE],
[D].[VID_NUM],
[M].[MOVIE_TITLE],
[D].[DETAIL_DUEDATE],
[D].[DETAIL_RETURNDATE],
[D].[DETAIL_FEE],
[D].[DETAIL_RETURNDATE] - [D].[DETAIL_DUEDATE] AS [DAYS_LATE]
FROM [DETAILRENTAL] AS [D] INNER JOIN
(
[RENTAL] AS [R] INNER JOIN
(
[VIDEO] AS [V] INNER JOIN [MOVIE] AS [M] ON [V].[MOVIE_NUM] = [M].[MOVIE_NUM]
) ON [D].[VID_NUM] = [V].[VID_NUM]
) ON [D].[RENT_NUM] = [R].[RENT_NUM]
WHERE [D].[DETAIL_RETURNDATE] - [D].[DETAIL_DUEDATE] > 0
ORDER BY [R].[RENT_NUM], [M].[MOVIE_TITLE];
The error I receive is Syntax error in JOIN operation. I know what that means, but I don't know MS Access' SQL well enough to spot the error.