您如何最好地在SubSonic中构建此SQL语句?
SELECT ac.*
, SUM(pt.amount) AS totalPoints
FROM tbl_account AS ac
INNER JOIN tbl_pointTracking AS pt ON ac.id = pt.accountID
GROUP BY pt.accountID
ORDER BY totalPoints DESC;
我知道如何处理聚合,但不知道如何处理与其他列的聚合。
谢谢大家,
-Steve
答案 0 :(得分:1)
以下是帮助您这样做的代码。
gvGroup.DataSource = office.DB.Select(SubSonic.Aggregate.GroupBy("Designation"), SubSonic.Aggregate.Count("Designation")).From(Of office.Employee).ExecuteDataSet
gvGroup.DataBind()