I have a multi-database application that has a query that is giving me execution problems with MariaDB 10.6.12 (Windows).
The same query works perfectly when run against MYSQL 8.0.27
However, when it is run on MariaDB, I got Error: 1064-42000
Error: 1064-42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UT where not UT.ld_tag in (select distinct(B.ld_tag) from ld_tag B, ld_docum...'
Here is the full statement formatted
DELETE FROM ld_uniquetag UT WHERE NOT UT.ld_tag IN (SELECT DISTINCT( B.ld_tag ) FROM ld_tag B, ld_document C WHERE UT.ld_tenantid = B.ld_tenantid AND UT.ld_tag = B.ld_tag AND C.ld_id = B.ld_docid AND C.ld_deleted = 0) AND NOT UT.ld_tag IN (SELECT DISTINCT( D.ld_tag ) FROM ld_foldertag D, ld_folder E WHERE UT.ld_tenantid = D.ld_tenantid AND UT.ld_tag = D.ld_tag AND E.ld_id = D.ld_folderid AND E.ld_deleted = 0)
Is there anyone who can help me to reformulate it and make it more portable?