diff --git a/PlayBot/utils/db/get.pm b/PlayBot/utils/db/get.pm
index f37d8c42da582bb37f52349fd52cd01392c3dd02..1d00e884221a3eb192c4bb9b68c7806b55b649e0 100644
--- a/PlayBot/utils/db/get.pm
+++ b/PlayBot/utils/db/get.pm
@@ -179,8 +179,8 @@ sub _prepare_request {
     else {
         if ($query->is_global) {
             $req = 'select p.id, p.sender, p.title, p.url, p.duration, p.external_id, p.type';
-            $req .= ' from playbot p';
-            $req .= ' where '.$words_sql.' and' if ($words_sql);
+            $req .= ' from playbot p where';
+            $req .= ' '.$words_sql.' and' if ($words_sql);
             $req .= ' p.playlist is false';
             $req .= ' group by p.id order by rand()';