How to use group by in SQL Server query?

前端 未结 5 1302
死守一世寂寞
死守一世寂寞 2020-12-10 16:37

I have problem with group by in SQL Server

I have this simple SQL statement:

select * 
from Factors 
group by moshtari_ID

and I get

5条回答
  •  孤街浪徒
    2020-12-10 17:01

    If you are applying group clause then you can only use group columns and aggregate function in select

    syntax:

    SELECT expression1, expression2, ... expression_n, 
           aggregate_function (aggregate_expression)
    FROM tables
    [WHERE conditions]
    GROUP BY expression1, expression2, ... expression_n
    [ORDER BY expression [ ASC | DESC ]];
    

提交回复
热议问题