I have the following tables:
User (1:M) USerProduct (M:1) looukuptable_Product
User_ID (pk) UserProd_Autoid (pk) P_Id (PK) identity
P_Id (fk) product_ID
I also have:
Lookuptable_X (1:M) UserProduct
X_autoID UserProd_Autoid (pk)
X_Value P_Id (fk)
I need to migrate data to table USERProduct. The tables User, lookuptable_product andlookuptable_X are all already populated.
The source table is in this format:
user_ID, X_value, product_ID,.....
I need to write an insert into select * from statement to insert all values from sourcetable to userproduct. however I am not sure how to extract the X_ID from X_Value of source table 'while' I am inserting data....
Let me know if you need more clarifications.
Many thanks in advance