AnsweredAssumed Answered

SQL Database Statement for Yesterday

Question asked by ElliottKeene3591 on Apr 27, 2016
Latest reply on May 16, 2016 by ElliottKeene3591

I'm trying to grab transactions in a MySQL DB based on a field called 'updated_at', where the data looks like so (for yesterdays date, for example): 20160426 172600. I don't care so much about the time, it's just all transactions with the date value for yesterday.


This is the SQL statement I have at present, but it's grabbing 0 files.


SELECT updated_at FROM transactions WHERE date_format(curdate() - interval 1 day, '%Y%m%d') * 1 = created_at * 1


I know there is data with this value because I'm run thousands of records of the following statement


SELECT updated_at FROM transactions WHERE updated_at > '20160426'


Does anyone know the correct statement that would work, and where I'm going wrong please?