For instance, if you have the following error:
Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column
745 [select afe.AFEDataId, afe.Name, afe.AdditionalDescription, afe.ProjectType,
afe.BusinessUnit, afe.plantId, afe.fuelTypeId, afe.DisplayStatus, afe.BudgetedAmount,
sum(exp.Amount), afe.CreatedDate from TransAlta.AFE.Model.AFEData as afe inner join
afe.Expenditures as exp inner join exp.ExpenditureType where (afe.Status.StatusId =
:statusId) and (afe.IsRestrictedVisibility = false OR (select count(AFEDataId) from
TransAlta.AFE.Model.Reader as r where r.AFEData.AFEDataId = afe.AFEDataId AND
r.Contact.ContactId = '70bc6350-c466-40d5-a067-9d1f00bed7dc') > 0 OR (select count(AFEDataId)
from TransAlta.AFE.Model.Editor as e where e.AFEData.AFEDataId = afe.AFEDataId AND
e.Contact.ContactId = '70bc6350-c466-40d5-a067-9d1f00bed7dc') > 0 OR 1=1) afe.AFEDataId,
afe.Name, afe.AdditionalDescription, afe.ProjectType, afe.BusinessUnit, afe.plantId,
afe.fuelTypeId, afe.DisplayStatus, afe.BudgetedAmount, afe.CreatedDate order by afe.Name ASC]
Go and look at character 745 from the original query that was provided and check to see if there is a spelling error, as there was in this one that I just looked at.