You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND container__frontlightbox.i_foreigncode=''' at line 2
SELECT DISTINCT container__frontlightbox.i_containercode FROM container__frontlightbox
WHERE container__frontlightbox.i_containercode= AND container__frontlightbox.i_foreigncode=''