Query gives 2 different results

Hi ,

On executing below 2 queries I’m getting different results. Just wanted to understand the difference between both the queries.

  1. SELECT * FROM SAMPLE WHERE REGNO NOT IN ( SELECT DISTINCT ID FROM STUDENT)

  2. SELECT * FROM SAMPLE WHERE REGNO NOT IN ( SELECT RAW ID FROM STUDENT)

RAW will give you an array of just IDs; without the RAW keyword the results are objects. Compare the results from the two sub-queries run directly and you’ll see the difference.

Ref: https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/selectclause.html#raw-element-value

HTH.

1 Like