Forum Discussion
RaulSG
Jan 04, 2022Brass Contributor
Update query
Hello community! I need to update the field price of a table with this condition: to all type C items, increase the value of the price of type A items by 65%. That is to say: Item - Price - Type...
RaulSG
Jan 04, 2022Brass Contributor
olafhelper Sorry,
From:
Item - Price - Type
Item1 - 10 - A
Item2 - 15 - A
Item1 - 12 - B
Item2 - 20 - B
Item1 - 1 - C
Item2 - 1 - C
To:
Item - Price - Type
Item1 - 10 - A
Item2 - 15 - A
Item1 - 12 - B
Item2 - 20 - B
Item1 - (10+ (10*65%)) - C
Item2 - (15+(15*65%)) - C
olafhelper
Jan 05, 2022Bronze Contributor
RaulSG , something like this?
SELECT A.Price * 1.65 - C.Price
FROM yourTable AS A
INNER JOIN
yourTable AS C
ON A.Item = C.Item
WHERE A.Type = 'A'
AND C.Type = 'C'