Como converto o seguinte select
SELECT TOP (60) COUNT(*) AS QTD, SUM(Duration) AS Total, AVG(Duration) AS Media, MIN(Duration) AS Menor, LEFT(TextData, 80) AS TextData
FROM Traces WITH (nolock)
WHERE (StartTime >= DATEADD(D, - 7, GETDATE())) AND (DataBaseName IN ('database_1', 'database_2'))
GROUP BY TextData, DataBaseName
HAVING (COUNT(*) > 1)
ORDER BY Total DESC
estou tentando da seguinte maneira:
var lambda = ctx.Traces.Where(q => q.DataBaseName == "database_1" || q.DataBaseName == "database_2")
.GroupBy(a => new { a.TextData, a.DataBaseName })
.Select(b => new {
QTD = b.Count(),
Total = b.Sum(b1 => b1.Duration),
Media = b.Average(b1 => b1.Duration),
Menor = b.Min(b1 => b1.Duration),
textData = b.Select(b2 => b2.TextData) //aqui o problema
})
.OrderByDescending(b => b.Total)
.Take(10)
.ToList();
porém não consigo recuperar o TextData
ele retorna algo do tipo:
System.Collections.Generic.List`1[System.String]
os outros campos estão ok.