[eluser]kurucu[/eluser]
It would be worth echoing the generated sql (including the variable, to confirm that what is being run is the same as you assume) and then popping that into PHPmySQL or your equivalent to see if the query runs and what it returns.
In fact, turn on profiling temporarly and see what queries are being run without any further intervention!