It seems that comparing records using == or != does not work (the records are not really compared).
Created attachment 91 [details] Model
Created attachment 92 [details] Query file for test case
Fixed on trunk (rev. 1572).