GROUP BY using parameters in SQL

前端 未结 4 1971
一整个雨季
一整个雨季 2020-12-19 11:01

I am trying to somehow group a report based on a drop-down list of parameters that is pre-defined. I want to be able to subtotal the Total Hours or Total Pay of my report b

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-19 11:50

    Group by is simple really.

    You have to list in group by every field that is included in the select statement and not fed to an aggregate function.

    Which is why you can't have a variable group by with a fixed list of columns in select. (Well, you can in mysql, but it effectively applies virtual any() aggregate to them.)

提交回复
热议问题