Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Joining to tables with bad data

Author  Topic 

slihp
Yak Posting Veteran

61 Posts

Posted - 2015-03-05 : 08:41:22
I have a table that holds product prices. It was originally designed to hold historical price values of products but this was abandoned after a few years. So now NEW products have only one entry in this table but some older products can have multiple entries. the ones with multiple entries can have a mixture of nulls or dates set in either or both or none of the StartDate and EndDate its totally random. only thing i can seem to rely on is the LastUpdated value.


Hows best to join to this table to get the LATEST product price for old and new products. At some point ill be going through a data cleansing exercise but this could be some time away.


ProductPrice table
--------------------

[/URL]
   

- Advertisement -