For any comparison operator listed in the table shown below, the sub-query must return single row (in other words, the sub-query, must be a single-row sub-query, otherwise it will fail)
Symbol | Meaning |
---|---|
= | equal |
> | greater than |
>= | greater than or equal |
< | less than |
<= | less than or equal |
<> | not equal |
!= | not equal |
The operators in the following table can use multiple-row sub-queries:
Symbol | Meaning |
---|---|
IN | equal to any member in a list |
NOT IN | not equal to any member in a list |
ANY | returns rows that match any value on a list |
ALL | returns rows that match all the values in a list |
There are several approaches to resolve this, most popular one being changing the inequality operator to a multiple-row operators (say, if the operator is "=" than change it "IN", "ANY", "ALL", so that it does not matter if multiple rows are returned.).
However, I found that if you use inline views, you can retain inequality operator as shown below in (Screen -2)
Note: In order to get consistent result, use the sub-query based on primary key. The above method is based on unique key