简体   繁体   中英

Athena query error : extraneous input 'select' expecting

Got an error while running query:

extraneous input 'select' expecting {'(', 'add', 'all', 'some', 'any', 'at', 'no', 'substring', 'position', 'tinyint', 'smallint', 'integer', 'date', 'time', 'timestamp', 'interval', 'year', 'month', 'day', 'hour', 'minute', 'second', 'zone', 'filter', 'over', 'partition', 'range', 'rows', 'preceding', 'following', 'current', 'row', 'schema', 'comment', 'view', 'replace', 'grant', 'revoke', 'privileges', 'public', 'option', 'explain', 'analyze', 'format', 'type', 'text', 'graphviz', 'logical', 'distributed', 'validate', 'show', 'tables', 'views', 'schemas', 'catalogs', 'columns', 'column', 'use', 'partitions', 'functions', 'to', 'system', 'bernoulli', 'poissonized', 'tablesample', 'unnest', 'array', 'map', 'set', 'reset', 'session', 'data', 'start', 'transaction', 'commit', 'rollback', 'work', 'isolation', 'level', 'serializable', 'repeatable', 'committed', 'uncommitted', 'read', 'write', 'only', 'call', 'input', 'output', 'cascade', 'restrict', 'including', 'excluding', 'properties', 'function', 'lambda_invoke', 'returns', 'sagemaker_invoke_endpoint', 'nfd', 'nfc', 'nfkd', 'nfkc', 'if', 'nullif', 'coalesce', identifier, digit_identifier, quoted_identifier, backquoted_identifier}

query is right join table ss with dd,like:

select * from 
(
select platform, id, nextMonth
FROM "logs"."user_records"   as ss
right join 
select id as idRight, platform, month
FROM "logs"."user_records"  as dd

on ss.platform = dd.platform and ss.userid = dd.useridRight and ss.nextMonth=dd.month   ) 

You probably need to surround the subquery after your right join in parentheses. Untested, but I'd guess:

select * from 
(
select platform, id, nextMonth
FROM "logs"."user_records"   as ss
right join 
( select id as idRight, platform, month
FROM "logs"."user_records" )  as dd

on ss.platform = dd.platform and ss.userid = dd.useridRight and ss.nextMonth=dd.month   ) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM