"Mismatched input 'select'" error when using "where not exists" clause in hiveQL

Viewed 16

Why does the following hive query generate a "mismatched input 'select'" error?

select d1.* from
    (select dim_iso_code from tableA where ds='2022-06-01') d1
where not exists
select d2.* from
    (select dim_iso_code from tableA where ds='2022-04-18') d2
where d1.dim_iso_code = d2.dim_iso_code    

'message': "line 4:1: mismatched input 'select'. Expecting: '('", 'errorCode': 1, 'errorName': 'SYNTAX_ERROR', 'errorType': 'USER_ERROR',

I have tried numerous variations on this and they all fail with similar errors.

1 Answers

The following is working - a bit simplified from the original

select d1.* from 
  (select dim_iso_code from tableA where ds='2022-06-01') d1
where not exists
    (select dim_iso_code from tableA where ds='2022-04-18')
Related