My SQL will not work in one of my queries. I keep getting "must contain 1 table or query". Bit I do list the table... Any ideas what is wrong with the SQL below?
INSERT into xxxxx (Project, costType, jobCharge, ResourceDesc, [upper/lower], Cat, SumOfhours, SumOfcost, SumOfoverhead) SELECT projectData.Project, projectData.costType, wbsData.jobCharge, resourceCodes.ResourceDesc, resourceCodes.[upper/lower], IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","CM Act","na"),"na")) AS Cat, Sum(projectData.hours) AS SumOfhours, Sum(projectData.cost) AS SumOfcost, Sum(projectData.overhead) AS SumOfoverheadFROM ((projectData LEFT JOIN resourceCodes ON projectData.resourceCode = resourceCodes.ResourceCode) LEFT JOIN ProgramDetails ON projectData.Project = ProgramDetails.ProjectNumber) LEFT JOIN wbsData ON (projectData.Project = wbsData.Job) AND (projectData.WBS = wbsData.wbsCode)GROUP BY projectData.Project, projectData.costType, wbsData.jobCharge, resourceCodes.ResourceDesc, resourceCodes.[upper/lower], IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","
CM Act","na"),"na"))HAVING (((IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","CM Act","na"),"na")))<>"na"))
INSERT into xxxxx (Project, costType, jobCharge, ResourceDesc, [upper/lower], Cat, SumOfhours, SumOfcost, SumOfoverhead) SELECT projectData.Project, projectData.costType, wbsData.jobCharge, resourceCodes.ResourceDesc, resourceCodes.[upper/lower], IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","CM Act","na"),"na")) AS Cat, Sum(projectData.hours) AS SumOfhours, Sum(projectData.cost) AS SumOfcost, Sum(projectData.overhead) AS SumOfoverheadFROM ((projectData LEFT JOIN resourceCodes ON projectData.resourceCode = resourceCodes.ResourceCode) LEFT JOIN ProgramDetails ON projectData.Project = ProgramDetails.ProjectNumber) LEFT JOIN wbsData ON (projectData.Project = wbsData.Job) AND (projectData.WBS = wbsData.wbsCode)GROUP BY projectData.Project, projectData.costType, wbsData.jobCharge, resourceCodes.ResourceDesc, resourceCodes.[upper/lower], IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","
CM Act","na"),"na"))HAVING (((IIf([costtype]="eac",IIf([fiscaldate]="200809","CM ETC","na"),IIf([costtype]="actual",IIf([fiscaldate]="200809","CM Act","na"),"na")))<>"na"))