Sql optimise killer query2

In this commit I have decomposed the getListQuery() method's query in to two cause for the readability and for improve the performance. In the previous query before the change there was a join operation to get the un-published category ids. In this query the former join has been removed and the un-published category ids are being retrieved separately. And then those ids are used with the NOT IN and IN operations in order to improve the performance
You should not use `$dbBadCat` as a variable name. Just add meaning full name which has actually meaning. I am not getting _BadCat_ meaning.