tmh766 Posted November 13, 2010 Share Posted November 13, 2010 Hi I can write this in multiple queries but I was hoping it would be possible to combine this into one. I have three tables: `mail`========================= #Contains a list of messages and their owning business ID. `businessId`,`message`,`sent` `business`====================== #Contains a business ID and a CSV of user IDs subscribed to to receive messages from this business. `businessId`,`name`,`userIdCsv` `user`========================= #Contains a user ID and their email. `userId`,`email` My goal is to first get all messages in the `mail` table that have not been sent (sent=0). Then for each each unsent message, for each `businessId` send a message to all user's emails. In other words, for each message where `sent`=0 I am trying to get rows with `mail`.`message`,`business`.`name,`business`.`userIdCsv`. Can anyone suggest a way to actually get `user`.`email` too all in one query instead of a CSV of user IDs? Any guidance would be appreciated! Thanks! Link to comment https://forums.phpfreaks.com/topic/218537-query-guidance/ Share on other sites More sharing options...
fenway Posted November 13, 2010 Share Posted November 13, 2010 Did the JOIN not work? Link to comment https://forums.phpfreaks.com/topic/218537-query-guidance/#findComment-1133812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.