Copy link to clipboard
Copied
Hey Guys - please help me.
I have these columns:
product_code
buying_price
markup
make
When I visit a product detail page, I am passing the product_code variable and the following query produces a selling price (ie buying_price x markup%)
SELECT ROUND(SUM(buying_price*(1+ (markup/100))),2)
FROM products
WHERE product_code = colname
All is well.
Imagine from my homepage I choose to view all products from a manufacturer on a results page. (ie I pass a 'make' variable)
What query can I run to ensure the 'selling price' is shown against each product?
At the momment all I can acheive is showing the complete selling cost of all products within that manufacturer.
Hope this makes sense - much appreciated if you would look into this for me.
Thanks
Copy link to clipboard
Copied
The following sample query demonstrates how to calculate one field (item_price) by applying the calculation to a Column Alias (AS item_price_sum):
SELECT item_code, item_description, item_price, SUM(item_price*1.5) AS item_price_sum FROM calculations GROUP BY item_code ORDER BY item_price ASC
Once an alias column is defined, Dreamweaver´s Bindings Panel will be displaying this "virtual field" alongside the real ones (e.g. item_code).
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more