We have a db that was converted by a third party from cube cart to prestashop. Mostly things went fine but recently found a couple thousand products that lack a discount reduction value.
I have found bits and pieces on how to do what we need but I just need help. This is my first foray into sql/php so bear with me and dont laugh too much.
After research I learned enough to do it within the same table but this playing with values from two different tables my brain goes "Im outta here."
SELECT *, (price - discount) AS Sum FROM Table1
I found some examples but nothing crosses over close enough to my needs to work or my syntax is messing things up.
Even a nudge in the right direction would mean a lot.
select b.*, (b.price - a.discount) as sum
from table2 b
left join table1 a on b.product_id = a.product_id
So if I understand this correctly table1 has product Id, base price, and table2 has discount?
It looks like you want to take table 2 and just add a column that has price after discount on every row?
Let me know and I can try and guide you further....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.