[步骤]
CODE:N110422530Error:16_8120_1_-2146232060
SQL:select
oif.OrderSourceTypeName as '销售平台'
,oif.OrderSourceName as '销售账号'
,ISNULL(oif.SKU,(SELECT TOP 1 SKU FROM RB_Product_OrderSourceSKU(NOLOCK) WHERE CustomerID=oif.CustomerID AND OrderSourceID=oif.OrderSourceID AND OrderSourceSKU=oif.SellerSKU AND SKU<>'')) as '系统SKU'
,oif.ClientSKU as '自定义SKU'
,isnull(B.ProductGroupSKU,'') as '母体SKU'
,Isnull(( CASE
WHEN B.ClassID1 = B.ClassID
THEN c1.ClassNameCn
WHEN B.ClassID1 != B.ClassID2
AND B.ClassID = B.ClassID2 THEN c1.ClassNameCn + ' >> ' + c2.ClassNameCn ELSE c1.ClassNameCn + ' >> ' + c2.ClassNameCn + ' >> ' + c3.ClassNameCn END ), '') AS '产品类别' ,ISNULL(abt.BrowseNodeName,'') AS '平台类目' ,oif.ProductNameCN as '产品中文名称' ,oif.AssignDevelopAdminName as '产品负责人' ,oif.DevelopAdminName as '产品开发人员' ,oif.EditAdminName as '产品编辑人员' ,oif.ImageAdminName as '图片编辑人员' ,oif.BuyerName as '采购人员' ,pa.DevelopTime as '开发时间' ,pa.AddTime as '产品添加时间' ,SUM(ProductNum+ProdutNumUpdate) as '销售数量' ,SUM(Profits) as '总利润' ,SUM(Incomes) as '总收入' ,SUM(Expenses) as '总支出' ,SUM(SalesPrice) as '销售收入' ,SUM(TransportPay) as '运费收入' ,SUM(SalesRefunds) as '退款金额' ,SUM(PromotionRebates) as '促销折扣' ,SUM(OtherCredits) as '其他收入' ,SUM(CommisionFee) as '交易佣金' ,SUM(FBATransactionFees) as 'FBA操作费' ,SUM(OrderSourceOtherDebits) as '平台其他支出' ,SUM(CostOfAdvertising) as '广告费用' ,SUM(isnull(CostOfAdvertising,0)/ExchangeRMB) as '广告费用(原币)' ,SUM(BuyPrice+ISNULL(DistributionPrice,0)) as '采购成本' ,SUM(ISNULL(SubsidyPrice,0)) as '补贴调整' ,SUM(ISNULL(SalesVatFee,0)) as '销售VAT' ,SUM(PackageFees) as '本地仓运费' ,SUM(OverSeasShipFees) as '海外仓派送运费' ,SUM(FirstLegFees) as '头程运费' ,SUM(TariffFees) as '进口关税' ,SUM(ExchangeLost) as '汇率折损' ,SUM(PackagedCost) as '包装成本' ,SUM(ISNULL(WareHouseManagementPrice,0)) as '仓库管理成本(自定义费用项)' ,SUM(ISNULL(CustomFeeOtherCostPrice,0)) as '其它费用成本(自定义费用项)' ,Sum(ISNULL(oif.Tax,0)) as '税费收入' ,Sum(ISNULL(oif.MarketplaceFacilitatorTax,0)) as '扣除客户支付税费' ,Sum(ISNULL(oif.ImportFee,0)) as '人工导入费用' from RB_Report_OrderSettlement oif (nolock) left join RB_Product_Admin pa with(nolock) on oif.CustomerID=pa.CustomerID and oif.SKU=pa.SKU LEFT JOIN RB_Product B WITH(NOLOCK) ON oif.CustomerID=B.CustomerID AND oif.SKU=B.SKU LEFT JOIN RB_Product_Class AS c1 WITH(nolock) ON B.CustomerID = c1.CustomerID AND B.ClassID1 = c1.ID LEFT JOIN RB_Product_Class AS c2 WITH(nolock) ON B.CustomerID = c2.CustomerID AND B.ClassID2 = c2.ID LEFT JOIN RB_Product_Class AS c3 WITH(nolock) ON B.CustomerID = c3.CustomerID AND B.ClassID = c3.ID LEFT JOIN E_Product_Amazon_BrowseTree abt(NOLOCK) ON abt.CustomerID=oif.CustomerID AND abt.SKU=oif.SKU AND abt.IsMain=1 AND abt.IsDelete=0 where 1=1 and oif.CustomerID=@CustomerID and oif.OrderSourceType in (select Id from @Tb_OrderSourceTypes) and oif.OrderSourceID in (select Id from @Tb_OrderSourceIDs) and oif.ShipDate>=@StartTime and oif.ShipDate<DATEADD(DAY,1,@EndTime) group by oif.OrderSourceTypeName,oif.OrderSourceName,oif.SKU,oif.ClientSKU,oif.ProductNameCN,oif.DevelopAdminName,oif.EditAdminName,oif.ImageAdminName,oif.BuyerName,pa.DevelopTime,pa.AddTime,oif.AssignDevelopAdminName,isnull(B.ProductGroupSKU,''),B.ClassID1,B.ClassID2,B.ClassID,c1.ClassNameCn,c2.ClassNameCn,c3.ClassNameCn,ISNULL(abt.BrowseNodeName,'') order by oif.OrderSourceTypeName,oif.OrderSourceName,oif.SKU PARAMS:@CustomerID = 1 ,@Tb_OrderSourceTypes = 1, ,@Tb_OrderSourceIDs = 6400,6399,10429,10541,6621,12070,6617,9883,7890,17479,12566,18010,17496,17481,17480,17478,17477,17476,16511,16508,16295,16294,16293,16292,16291,16290,16289,16288,16287,16286,16285,16284,16283,14927,14749,14518,14086,13926,13921,13920,13919,13918,13917,13916,13915,13914,13867,13866,13601,13600,13599,13432,13431,12565,12530,12069,12068,11993,11463,11462,11461,11139,11137,11028,11027,11026,11025,11024,11023,10895,10891,10766,10764,10763,10762,10540,9924,9881,9873,9641,9491,9490,9489,9487,8511,8392,8357,7980,7979,7978,7977,7976,7827,7521,7520,7519,7518,7517,7516,7515,6954,6953,6952,6951,6950,6949,6948,6623,6622,6620,6619,6618,6553,6552,6551,6479,6095,6094,6093,6092,6091,6090,6089,5383,8505,9488,8393,8362,7825,11138,3000,5384, ,@StartTime = 2023/4/1 0:00:00 ,@EndTime = 2023/4/30 0:00:00 , MESSAGE:Column 'RB_Report_OrderSettlement.CustomerID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Column 'RB_Report_OrderSettlement.OrderSourceID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. Column 'RB_Report_OrderSettlement.SellerSKU' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. TRACE: 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) 在 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() 在 System.Data.SqlClient.SqlDataReader.get_MetaData() 在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) 在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) 在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) 在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) 在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB) 在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms) 在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB) 在 RB.DALExtendV2.Generate.Report.RB_Report_OrderSettlementExtendV2.GetSettlementReportForSKU(RB_Report_OrderSettlement_PSParameters parameters) 在 Biz.TaskApply.ReportTaskMethods.GetReportForSKU(Report_OrderSettlementForSKUParamer parameters) 在 System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) 在 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 在 Biz.TaskApply.ReportTaskApply.ReportTaskExecute(RB_ReportApply_Task task) 在 Biz.TaskApply.ReportTaskApply.ProcessExportExcel(RB_ReportApply_Task task) 在 RB.Utility.TaskSmartManager`1.execute(Func`2 execFunction) 在 System.Threading.Tasks.Task.Execute() 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) 在 System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution) 在 System.Threading.ThreadPoolWorkQueue.Dispatch()
[结果]
[期望]