Hi,
Yes, the MySQL query is the correct in our plugin. I have run this query on my server and I am getting the correct result.
Please see the screenshot: https://www.screencast.com/t/iMefbqBhvT
Can you please share with us error message which is occurring on your site? So, I can provide you such a solution and I can more look into this.
Let me know if you have any question with this.
Regards,
Chetna Bhutka