Hi to all,
How to make sure below SQL is updating right price ?
Need to update only 1000 transaction with correct price, on or after effective date.
There are 1000 transaction and on running below SQL query, message shows updated 2130 transaction record.
Please guide/help.
Thank you,
Ken
How to make sure below SQL is updating right price ?
Need to update only 1000 transaction with correct price, on or after effective date.
There are 1000 transaction and on running below SQL query, message shows updated 2130 transaction record.
Code:
Update TransactionTbl T1
INNER JOIN PriceTbl T2 on T1.ProductId = T2.ProductId
set T1.price = T2.price
where [COLOR=#EF2929]T1.TrDate > = T2.EffectiveDate[/color]
Table: TransactionTbl
TrDate ProductId Price
4/30/2018 P0001 $19
5/ 1/2018 P0001 $20
5/ 2/2018 P0001 $20
5/ 4/2018 P0001 $22
Table: PriceTbl
ProductId EffectiveDate Price
P0001 5/1/2018 $20
P0001 5/3/2018 $22
Please guide/help.
Thank you,
Ken