does this logic work?
I have a DB that is storing emails to send. I want to have my script send 5 at a time. There are two types of emails, Type A - important, Type B marketing material. I have my script requesting 5 emails to send, now I want it to first choose 5 Type A emails over Type B, easy, however if there are only 2 Type A messages I want it to pick up 3 of the Type B to make it a full round to sned off to the smtp.
Message 1, Type A
Message 2, Type B
Message 3, Type B
Message 4, Type B
Message 5, Type B
Message 6, Type A
Message 7, Type B
It should be selecting message 1,6,2,3,4
SELECT A.id, A.r_email, B.subject, B.content FROM recipients AS A INNER JOIN content AS B ON B.id=A.id LIMIT 5
why the need to send only 5 messages at a time?
Thanks for that, I did try that but it was giving an strange order. I added a key and now it is working correctly. 5 was just an arbitrary number I gave, I can in fact send 5 a second but it was more about showing an example to you guys. Thanks again