SELECT "STORE VISIT",STORE,USERVISITED
FROM ECRSURVEY
WHERE "STORE VISIT" > '2014-01-01 00:00:00.000'
GROUP BY STORE, "STORE VISIT", UserVisited
这不应该返回列STORE的不同分组吗?我的结果是同一个商店的多个条目。
答案 0 :(得分:1)
获得明确的STORE
:
SELECT STORE
FROM ECRSURVEY
WHERE "STORE VISIT" > '20140101'
GROUP BY STORE
或
SELECT DISTINCT STORE
FROM ECRSURVEY
WHERE "STORE VISIT" > '20140101'
或
如果您对其他两个字段进行聚合,那么您应该获得唯一的行
SELECT STORE
NumStoreVisit = COUNT("STORE VISIT"),
NumUserVisited = COUNT(UserVisited)
FROM ECRSURVEY
WHERE "STORE VISIT" > '20140101'
GROUP BY STORE
但是如果您的数据结构如下,则您要求不可能: