Fix query statement error

an error was in subquery at single quote and alias name in where cluase,
fix by delete single qoute and use full name with table alias name