SQL语句出错
SQL = "SELECT [G-Title].[G-Number] as [G-Number],[Local],[G-Name],[ManagerSign],[Update-Time],[S-Date],[E-Date],[Locked],[BookingHeader].[Booking_Count]"SQL = SQL & " FROM [G-Title] LEFT JOIN (SELECT [G_Number] as [G-Number],count([M_Number]) as [B_Count] from [bookingbody] group by [G_Number]) as [Booking] ON [G-Title].[G-Number] = [BookingBody].[G-Number]"
SQL = "SELECT [MainData].*,[MCount].[M_Count] FROM (" & SQL & ") as [MainData] LEFT JOIN (SELECT [G-Number],count([G-Number]) as [M_Count] FROM (SELECT [G-Number],[M_ID] FROM [GroupMembers] GROUP BY [G-Number],[M_ID]) GROUP BY [G-Number]) as [MCount] ON [MainData].[G-Number] = [MCount].[G-Number]"
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]在关键字 'GROUP' 附近有语法错误。
大家帮帮忙啊!