Interesting query: Documents where fields match and don't match

I have an interesting query I'd like to run.

I'd like to find all documents where field field1 == field1, but field2 != field2.

So in layman's terms, maybe the negation is easier: don't show me documents where field1 always has the same field2 value (not that field1 matches field2, but that field2 never varies).

So for the example data set:

User     Login_Location
jon       US
ben       US
ben       Nigeria
jon       US
sam       UK
jon       US
sam       AU

I want to get the documents for ben and sam, because they have Login_Locations that have a variance.

Can anyone give me clues on how to accomplish this query?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.