开发者

SubSonic: Selecting all columns with an aggregate

How would you best handle constructing this SQL statement in SubSonic?

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;

I know how to handle aggregates, but not sure how to handle aggregates with other columns.

Thanks all,

-Steve


Here is the code which will help you to do so.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜