I have below table. I want this products table to be updated based on @source json
product_id, product_name,total_sales
OPENJSON gives me key and value , but how do i explicitly set column names for my json
and also while doing join i need to skip electronics then only it will do join
This code throws error as key not found
begin
declare @source nvarchar(max) = '{"electronics.tv":200,"electronics.mobile":1000}'
UPDATE p
SET p.total_sales = u.value
products p
INNER JOIN
OPENJSON(@source,'$') AS u
ON p.product_name = u.key
end
It thows error as incorrect syntax near key
Can someone help me here

KEYis a reserved keyword, it must be delimit identified.WITHclause, such as shown in example 3 of the documentation