我有一个DataTable,其中包含用户可以执行的事务。如何通过LinkedId显示EstimatedTransTime的总和,并在汇总后显示该LinkedTickedId的最大事务?
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];
DataTable newDataTable
= dt.AsEnumerable()
.Where(r => !ListLinkedIds.Contains(r.Field<int>("LinkedTicketId")))
.CopyToDataTable();
gvMain.DataSource = newDataTable;
gvMain.DataBind();
答案 0 :(得分:0)
我认为你的查询应该是这样的
SELECT TicketID,DisplayNum,TranstypeDesc, SubQueueId,SUM(EstimatedTransTime),LinkedTicketId FROM vwQueueData WHERE (DATEADD(day,DATEDIFF(day,0,Issued),0)= DATEADD(day,DATEDIFF(day,0, GETDATE()),0))AND QId = @QId AND SubId = @SubId AND Called IS NULL group by LinkedTicketId
尝试这个并告诉我是否有任何错误