Question
Update recordset after cfmail?
I would like to update a status field for each record that is
used in cfmail tag after the email is sent. My thought is that I
can could use a cfquery like so:
SELECT email, firstname, id, sendstatus
FROM emailtable
WHERE sendstatus = 0
ORDER BY ID DESC LIMIT 5000
I would then use this recordset inside my cfmail tag but once the send is complete I would like to update the sendstatus field from a zero to a 1. When the page is called again these records would be skipped and the next 5000 records would be sent.
I assume that I could use a cfloop to loop through the original query and do a UPDATE for each record but that does not seem to be very efficient. Is there a better way that I could use so that I would only execute one update statement to update all of the records without repeating the original sql statement?
SELECT email, firstname, id, sendstatus
FROM emailtable
WHERE sendstatus = 0
ORDER BY ID DESC LIMIT 5000
I would then use this recordset inside my cfmail tag but once the send is complete I would like to update the sendstatus field from a zero to a 1. When the page is called again these records would be skipped and the next 5000 records would be sent.
I assume that I could use a cfloop to loop through the original query and do a UPDATE for each record but that does not seem to be very efficient. Is there a better way that I could use so that I would only execute one update statement to update all of the records without repeating the original sql statement?
