SubSonic:选择具有聚合的所有列

时间:2009-12-02 17:28:02

标签: c# subsonic2.2

您如何最好地在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

1 个答案:

答案 0 :(得分:1)

以下是帮助您这样做的代码。

  gvGroup.DataSource = office.DB.Select(SubSonic.Aggregate.GroupBy("Designation"), SubSonic.Aggregate.Count("Designation")).From(Of office.Employee).ExecuteDataSet
        gvGroup.DataBind()