group by子句的默认值

时间:2013-10-30 05:40:16

标签: sql group-by

我想要group by子句的默认值。

我尝试使用以下查询但未获得成功

SELECT ISNULL(MAX(Sum(points)),0)  
   FROM Table1 
   group by PanelistID having PanelistID = 4310497

请完整

1 个答案:

答案 0 :(得分:1)

SELECT 4310497 AS some, ISNULL(MAX(Sum(points)),0)  
   FROM Table1 
WHERE PanelistID = 4310497
   GROUP BY  PanelistID

您可以在SELECT CLAUSE中插入常量值,它不会对GROUP CLAUSE

产生影响