Is 'application' a column in one of your tables? Maybe you are using the wrong column name in the conditions.