Several of us ask you questions and you never answered them. We also suggested that you first write your query MANUALLY and test it to make sure you get the correct results instead of trying to construct it dynamicaly.

You never bothered to do that either. If you want help you also need to answer the questions that people ask you.

Again you have posted code but have NOT posted the session showing the execution of the code and the results that it gives. We told you about this in your other thread.