S02001
Error Code
S02002
Error Message
Duplicate column name: <xxx>. RefId:S02001
Probable Causes
This error occurs when executing SQL statements with duplicate column names in SELECT column (or GROUP BY column if has). The probable causes may include:
-
Duplicated names in SELECT statement, e.g.,
select id, id from a
orselect id, val as id from a
. -
Name duplicated with the implicit alias from functions, expressions, or analytic functions, e.g.,
select id as sum, sum(id) over () from a
. -
Name duplicated with the implicit alias from the join results, e.g.,
select a.id + 1 as b_id, * from a, b where a.id = b.id
. -
Name duplicated with the DolphinDB reserved column names: col + numbers (e.g., "col1").
Solutions
-
Check the specified column names in SELECT statement or GROUP BY clause.
-
Use the
as
keyword to rename the column. -
Avoid to use the DolphinDB reserved column names. You can use underscores as the prefix and suffix, e.g. "_id_" or use special symbols, e.g. "{0|V^^N3".