sqlce3.5中的group by给出了“in aggregate and grouping”错误

时间:2012-03-07 04:42:29

标签: sql vb.net sql-server-ce

我在这里寻找同样的问题,但在任何地方我都看到他们只是明显地使用GROUP BY

使用下面的语句,它返回“在聚合和分组表达式中,CLAUSE只能包含聚合和分组表达式”

这有效:

SELECT     prop_id, a_id, prop_type, prop_value
FROM         a_properties
WHERE     (prop_type = 'WHOLENAME') AND (prop_value LIKE '%jan%') OR
                      (prop_type = 'WHOLENAME') AND (prop_value LIKE '%ben%')
ORDER BY a_id

这不是:

SELECT     prop_id, a_id, prop_type, prop_value
FROM         a_properties
WHERE     (prop_type = 'WHOLENAME') AND (prop_value LIKE '%jan%') OR
                      (prop_type = 'WHOLENAME') AND (prop_value LIKE '%ben%')
GROUP BY a_id
ORDER BY a_id

但我只想要a_id一次......

不能使用TOP因为那时我没有得到明显的a_id

0 个答案:

没有答案