1 Answer
- Newest
- Most votes
- Most comments
0
Timestamp and Count are reserved words. It is recommended to avoid using these as column names. Else use double quotes around them in your code as shown below. Note that I have removed the table "a" and table "b" as you were not using them anyways
WITH c as (
SELECT "timestamp", "count" FROM foo
UNION ALL
SELECT "timestamp", "count" FROM bar
)
SELECT "timestamp", SUM("count")
FROM c
GROUP BY 1;
answered 2 years ago
Relevant content
- asked 9 days ago
- Accepted Answerasked 6 months ago
- Accepted Answerasked 7 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago
timestamp is a reserved word so it might be having trouble trying to associate the position alias of "1" with the reserved word "timestamp". Try using double quotes around the column name and/or explicitly using the column name in the group by rather than the position alias.