View Single Post

  #2 (permalink)  
Old 11-06-2007
xenides@gmail.com
 
Posts: n/a
Default Re: How can I improve the performance of this kind of query?

Ted

The statement

AND B.price_date > A.price_date
WHERE B.price_date IS NULL

is contradictory. For B.price_date > A.price_date to return true,
then B.price_date has to be NOT NULL (otherwise it returns null). On
the next line you are asking B.price_date to be NULL. Seems like you
are doing a lot of comparison work for no purpose.

Also B.price_date is null will return unmatched rows in B or matched
rows where B.price_date is null. Not sure if that is what you want?
In fact I can't see a reason to have table B in there at all. What
was your purpose for including it?

X



Reply With Quote