开发者

SubSonic: Selecting all columns with an aggregate

开发者 https://www.devze.com 2022-12-13 05:38 出处:网络
How would you best handle constructing this SQL statement in SubSonic? SELECT ac.* , SUM(pt.amount) AS 开发者_如何转开发totalPoints

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

精彩评论

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