I have a query where I only want to show results where the data was recently updated (yesterday or sooner).
My query pulls data from 4 different tables, so I need to check the LAST_UPDATE_DATE column of each table.
If any of them have a LAST_UPDATE_DATE value that was yesterday or sooner, then I want to pull all that data.
So I added this to my query:
AND (a.LAST_UPDATE_DATE >= dateadd(day,datediff(day,1,GETDATE()),0)
OR b.LAST_UPDATE_DATE >= dateadd(day,datediff(day,1,GETDATE()),0)
OR c.LAST_UPDATE_DATE >= dateadd(day,datediff(day,1,GETDATE()),0)
OR d.LAST_UPDATE_DATE >= dateadd(day,datediff(day,1,GETDATE()),0))
I think it's working, but is there a way to shorten the statement because it is very long and confusing.
Based on the limited information you provided in your question: