I just wanted to add, as a suggestion, that you should use table alias in your queries. It will make your queries shorter and easier to identify column...
After reviewing the code, I found that you are referring new_projecttasksBase which isn't included in the query. If you're referencing it, you need to add it to the...