Assign value of one column to other
Database
2
Posts
2
Posters
0
Views
1
Watching
-
Say I want to put in order details current price of product, but once it's assigned it stay as is (so if it's null copy from product table if not leave as is...). How to do this?
-
Say I want to put in order details current price of product, but once it's assigned it stay as is (so if it's null copy from product table if not leave as is...). How to do this?
IF EXISTS(SELECT PRICE FROM ORDER WHERE PRICE IS NULL AND PRODUCT=@YOUR_PRODUCT_ID) BEGIN --DO YOUR UPDATE HERE END ELSE BEGIN --PRICE ALREADY ASSIGNED END