3

I'm using Apache Phoenix to query Hbase. I tried to use a simple MINUS operator like we do in good old SQL but it produces an error that I couldn't wrap my head around.

Here's the query:

select * from NOTIFICATION MINUS select * from NOTIFICATION where SUBJECT = 'datanode';

Here's a screenshot: enter image description here

Note: It's not this specific query I'm looking to solve, I just want to get MINUS to work. Thanks.

1

I am not sure which SQL is used by Apache Phoenix and I cannot exclude that your code above contains syntax error but what I know is that the MINUS operator can only be used in Oracle SQL.

I suggest trying it with the EXCEPT operator which is used in Transact SQL: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-except-and-intersect-transact-sql

If the EXCEPT does also not work, try to imitate the MINUS like it is done in MySQL, which currently does not feature MINUS or EXCEPT at all: http://www.gokhanatil.com/2010/10/minus-and-intersect-in-mysql.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.