> how do I do this one piece of a query in MySQL, since I'm not a MySQL DBA
Honestly for most things, the actual documentation is the best resource. I needed to learn to stop looking for solutions to my issue on various fora (like SO) and just read the primary documentation from the vendor. Have a look at dev.mysql.com or mariadb.com/docs/server