Pues si no es eso, quizas lo mejor es preguntar en el apartado de base de datos.
Eso si mejor dejales la sentencia de forma medio leible
Código SQL:
Ver originalINSERT INTO email_queues (queueid, queuetype, ownerid, recipient, processed)
SELECT DISTINCT 13, 'send', 1, subscribers.subscriberid, 0
FROM email_list_subscribers AS subscribers
JOIN email_lists AS lists ON lists.listid = subscribers.listid AND lists.listid IN (1)
WHERE subscribers.listid IN (1)
AND (
(
subscribers.subscriberid IN (
SELECT d.subscriberid AS subscriberid
FROM email_subscribers_data d
WHERE d.fieldid = 15 AND d.DATA < 51
)
)
)
AND (subscribers.unsubscribed=0 AND subscribers.bounced=0)
UNION
SELECT DISTINCT 13, 'send', 1, subscribers.subscriberid, 0
FROM email_list_subscribers AS subscribers
JOIN email_lists AS lists ON lists.listid = subscribers.listid AND lists.listid IN (1)
WHERE subscribers.listid IN (1)
AND (
(
subscribers.subscriberid IN (
SELECT d.subscriberid AS subscriberid
FROM email_subscribers_data d
WHERE d.fieldid = 16 AND d.DATA < 4
)
)
)
AND (subscribers.unsubscribed=0 AND subscribers.bounced=0)
ORDER BY subscribers.subscribedate ASC
LIMIT 1000000000