My query : http://pastebin.com/8c2rLrRk
In this 3rd case 2nd when condition is causing the issue, if i comment that then query is running well. So pls let me know where the loophole in this syntax.
Error line: IFNULL(COUNT(blockedseats.seatNo),0) We can't club count and ifnull functions.