Subject Help with query
Author Rick Debay
I've found that vendors are sending us updates to items, where nothing
changes from the data we already have except for the effective date of
the change. Some of them are updating large portions of their product
catalog this way, making me think they took the easy way out of sending
us the date of the extract on every row, instead of the actual date the
particular item in the catalog changed.
I'd like to silently drop these. The problem is coming up with the
following query (which will live in an exists conditional):

/* see if there are any exact matches for any item who's date is
immediately before or after ours */
Select 1
From
catalog c
Where
c.col1 = :new_col1 And
c.col2 = :new_col2 And
...
c.colN = :new_coln and
(:new_date >= date_previous_to_new_date and :new_date <=
date_after_new_date)

I could do the last part as something like (I know the max/min >< stuff
isn't correct):

:new_date >= select min(date_col) where pk_col=:new_pk_col and date_col
< :new_date

But that seems quite inelegant.