Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Update recordset after cfmail?

Participant ,
May 28, 2008 May 28, 2008
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?
335
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 28, 2008 May 28, 2008
you don't need a loop. You need to learn a new keyword in sql "IN". To reference the first query, use the coldfusion function valuelist.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2008 May 29, 2008
LATEST
quote:

Originally posted by: Dan Bracuk
you don't need a loop. You need to learn a new keyword in sql "IN". To reference the first query, use the coldfusion function valuelist.

Thanks Dan! I will look into this and see what I can do.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources