function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeanette Albert 15Jeanette Albert 15 

Need help with SQL to pull Last Modified "TODAY"

I am using Dataloader.io to pull attachments since SFDC doesn't allow to create reports with Attachments.  I need to download only the data from the Cases these created from.  Unfortunately, the system was setup using "Doc Control" which is all apex. I don't know code I like Conga.

My goal is to download the data only from the Cases (tickets) Last Modified "TODAY" not by the Parent ID but I only get a DD/MM/YYYY in the filter.  
Could one of you smart Developers help me with some SQL code >  Something like this.....SELECT Id, Name, Body, Description, ContentType FROM Attachment WHERE (NOT Description LIKE '%Envelope%') AND LastModifiedDate = TODAY

I am using 3 SQL lines to download the PDF.
Docs List

(Pulling PIO-Proof of Insurance only)
  • SELECT Id, Name, Body, Description, ContentType FROM Attachment WHERE (NOT Description LIKE '%Envelope%') AND (NOT Description LIKE '%PNL Document%') AND ParentId = 'ParentRecordID'
     
  • PNLs >  ​​SELECT Id, Name, Body, Description, ContentType FROM Attachment WHERE Description LIKE '%PNL Document%' AND ParentId = 'ParentRecordID'
  •  Envelopes  > SELECT Id, Name, Body, Description, ContentType FROM Attachment WHERE Description LIKE '%Envelope%' AND ParentId = 'ParentRecordID'
Thank you
Kevin CrossKevin Cross
TODAY represents the current day at midnight; therefore, you only would be matching rows where the LastModifiedDate exactly occurred at 00:00:00, which is unlikely with an automated timestamp field.  Therefore, I suspect you want to use >= AND < in your code. 
LastModifiedDate >= TODAY AND LastModifiedDate < TOMORROW
In the case of today's date, I guess you can leave off the last part as their should be no records modified in the future; however, I just wanted to show you an example of how I would include an entire day in case you end up wanting something like this.
LastModifiedDate >= YESTERDAY AND LastModifiedDate < TODAY
I hope that helps!