не работает запрос
select [sd].colSurname, [sd].colName, [sd].colMiddleName, max([sd].EnterTime) , max([sd].ExitTime) from [ Select colSurname, colName, colMiddleName, colRegistrationTime as EnterTime, Getdate() as ExitTime From tblAllRegistrations a Inner Join tblEmployees b ON a.colAccountNumber=b.colAccountNumber Where (a.colRegistrationTime > Cast(Round(Cast(Getdate()As float)-0.5, 0, 0) As datetime)) and (a.colRegistrationTime < Cast(Round(Cast(Getdate()As float)+0.5, 0, 0) As datetime)) and (b.colDepartment=25) and colStatusNumber='28' and colDirection=1 ]. AS [sd] group by [sd].colSurname, [sd].colName, [sd].colMiddleName
запрос внутри после from [
работает в чем ошибка, уже облазил все доки. Просто я работаю с oracle, а тут надо на php сделать маленькую страничу, но с большими union-ами