This creates a new table putting together pieces of 2 tables where 2 conditions exist.
Now I that the table exists... the second time I run this I just want to update the values.
Can someone please help me change this query from a create new table... to update the existing table.
i tried this... still not working... at least for the 1 column
UPDATE dbo.DailyPositions_JEFF SET Settlement_Price = dbo.PositionsDB.Settlement_Price FROM dbo.DailyPositions_JEFF INNER JOIN dbo.AccountsDB ON dbo.DailyPositions_JEFF.Account_ID = dbo.AccountsDB.Account_ID
UPDATE dbo.DailyPositions_JEFF
SET
Settlement_Price = dbo.PositionsDB.Settlement_Price
FROM dbo.DailyPositions_JEFF
INNER JOIN dbo.PositionsDB
ON dbo.DailyPositions_JEFF.Account_ID = dbo.PositionsDB.Account_ID
Stephen Forero
ASKER
i'm losing my mind here.
I'm not sure if I found source or not.
Lets assume that the table columns are there but there is not data in dbo.DailyPositions_JEFF.
I am trying to populate these columns
dbo.PositionsDB.Account_ID, dbo.PositionsDB.Position_ID, dbo.AccountsDB.Account_Number,
dbo.AccountsDB.Account_Description, dbo.PositionsDB.COB_Date, dbo.PositionsDB.Qty_Net,
dbo.PositionsDB.Exchange, dbo.PositionsDB.Product, dbo.PositionsDB.Contract_Date,
dbo.PositionsDB.Option_Type, dbo.PositionsDB.Strike,
dbo.PositionsDB.Settlement_Price
. So using your examples I just have to UPdate the columns. This is the part I'm stuck on .
to make things a bit more confusing... and maybe the source of the problem
Account_ID is a unique identifier from AccountsDB
and Position_ID is a unique identifier from PositionsDB
is this why your update statement is not working... am I supposed to be updating all of them a tthe same time instead of each column?
--update statements here
Can you show me 1 example of updating 1 column with my inner join statements
I'm stuck there as well
thanks soo much