The query works, if I enter it directly into mysql command line client…