S02055
Error Code
S02055
Error Message
The DISTINCT keyword cannot be used with group by, context by, or pivot by.
RefId: S02055
Probable Causes
The
distinct
keyword eliminates all duplicate records. Therefore, it
cannot be used with group by
, context by
, or
pivot by
clauses for further deduplication. For
example:def createMyTable(n) {
intv = take(1..10, n)
symbol = take(`a`b`c, n)
id = rand(100, n)
strv = take("abs" + string(1..10), n)
doublev = rand(10.0, n)
return table(intv, strv, doublev, id, symbol)
}
n = 100
t = createMyTable(n)
SELECT DISTINCT id FROM t GROUP BY id => The DISTINCT keyword cannot be used with group by, context by, or pivot by.
Solutions
Remove the
group by
, context by
, or pivot
by
clauses from the SQL statement with the distinct
keyword.select DISTINCT id from t