Error in BAQ Report Dataset Query E10.0.700.4

You are missing a table alias.  I think it should be something more like:


(SELECT T2.Company, T2.PartNum, T2.Plant, sum(T2.Calculated_CountedCost) As CountedCostTotal FROM dbo.[BAQReportResult_" +
Parameters!TableGuid.Value + "] T2
GROUP BY T2.Company, T2.PartNum, T2.Plant) T2

Hi,

Maybe someone can point out what I'm doing wrong. I have a BAQ report with the detail from CCTag. I'm trying to join the output file to itself, using GROUP BY in the second instance to sum the total of each part/plant group and append the total to to the detail line for sorting purposes.

Here's the error I get:

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: System.Web.Services.Protocols.SoapException: An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Query execution failed for dataset 'BAQReportResult'. ---> System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'BY'.   at Microsoft.ReportingServic..........

And the data set:

="SELECT T1.[CCTag_Company],T1.[CCTag_WarehouseCode],T1.[CCTag_Plant],T1.[CCTag_CCYear],T1.[CCTag_CCMonth],T1.
[CCTag_FullPhysical],T1.[CCTag_CycleSeq],T1.[CCTag_PartNum],T1.[Part_PartDescription],T1.[CCTag_TagNum],T1.[CCTag_BinNum],T1.
[CCTag_CountedBy],T1.[CCTag_CountedQty],T1.[CCTag_CountedTime],T1.[CCTag_TagNote],T1.[CCTag_EntryPerson],T1.[CCTag_TagPrinted],T1.
[CCTag_TagReturned],T1.[CCTag_CountedDate],T1.[CCTag_TagStatus],T1.[CCTag_BlankTag],T1.[CCTag_LotNum],T1.[CCTag_SerialNumber],T1.
[CCTag_UOM],T1.[CCTag_FrozenQOH],T1.[CCTag_FrozenCost],T1.[CCTag_EntryDate],T1.[CCTag_EntryTime],T1.[CCTag_SheetNum],T1.
[CCTag_FrozenTranDate],T1.[CCTag_FrozenTranTime],T1.[CCTag_ActivityBeforeCount],T1.[Calculated_PartCost],T1.
[Calculated_CountedCost],T1.[Calculated_PreCountCost],T1.[Calculated_CountAdjQty],T1.[Calculated_CountCostAdj],T2.[CountedCostTotal]

FROM 

dbo.[BAQReportResult_" + Parameters!TableGuid.Value + "] T1

INNER JOIN

(SELECT  T2.Company, T2.PartNum, T2.Plant, sum(T2.Calculated_CountedCost) As CountedCostTotal FROM dbo.[BAQReportResult_" + 
Parameters!TableGuid.Value + "] T2

GROUP BY T2.Company, T2.PartNum, T2.Plant)

on T1.Company = T2.Company, T1.PartNum=T2.PartNum, T1.Plant=T2.Plant"


I'm sure my error will jump out at someone.

Thanks,

Joe

--

Joe D. Trent

Bigham Ag Equipment