G
Guest
I receive a "Multi-level GROUP BY clause is not allowed in a subquery" error when I try to run a report with the following query:
SELECT Vessel!VES_NM+" "+[Vessel Schedule]!VOY_CD AS [Vessel Voyage], [Vessel Schedule].VES_CD, [Vessel Schedule].VOY_CD, [Vessel Schedule].ETD_VER_TM, [Vessel Schedule Update Qry].MaxOfADD_DT, (SELECT Max([ETD_VER_TM]) FROM [Vessel Schedule] AS X WHERE X.[ETD_VER_TM] < [Vessel Schedule]![ETD_VER_TM] ) AS PrevETD, DateDiff("d",[PrevETD],[ETD_VER_TM]) AS Spacing
FROM [Vessel Schedule Update Qry] INNER JOIN ([Vessel Schedule] INNER JOIN Vessel ON [Vessel Schedule].VES_CD = Vessel.VES_CD) ON ([Vessel Schedule Update Qry].MaxOfADD_DT = [Vessel Schedule].ADD_DT) AND ([Vessel Schedule Update Qry].VOY_CD = [Vessel Schedule].VOY_CD) AND ([Vessel Schedule Update Qry].VES_CD = [Vessel Schedule].VES_CD)
ORDER BY [Vessel Schedule].ETD_VER_TM;
Any help is appreciated.
SELECT Vessel!VES_NM+" "+[Vessel Schedule]!VOY_CD AS [Vessel Voyage], [Vessel Schedule].VES_CD, [Vessel Schedule].VOY_CD, [Vessel Schedule].ETD_VER_TM, [Vessel Schedule Update Qry].MaxOfADD_DT, (SELECT Max([ETD_VER_TM]) FROM [Vessel Schedule] AS X WHERE X.[ETD_VER_TM] < [Vessel Schedule]![ETD_VER_TM] ) AS PrevETD, DateDiff("d",[PrevETD],[ETD_VER_TM]) AS Spacing
FROM [Vessel Schedule Update Qry] INNER JOIN ([Vessel Schedule] INNER JOIN Vessel ON [Vessel Schedule].VES_CD = Vessel.VES_CD) ON ([Vessel Schedule Update Qry].MaxOfADD_DT = [Vessel Schedule].ADD_DT) AND ([Vessel Schedule Update Qry].VOY_CD = [Vessel Schedule].VOY_CD) AND ([Vessel Schedule Update Qry].VES_CD = [Vessel Schedule].VES_CD)
ORDER BY [Vessel Schedule].ETD_VER_TM;
Any help is appreciated.