on 2023 Feb 01 7:31 PM
Hi,
I want to list the best-selling products in the product category in the product crousel on the product detail page, While doing this, I plan to keep the products as a list field on the components with a cronjob. Has anyone done anything like this before?
Request clarification before answering.
Here is the solution for your requirement:
SELECT TOP 100 {P.PK}, SUM({OE.initialQuantiy}) as orderedQuantity
FROM
{Orderentry AS OE JOIN Product AS P ON {OE.PRODUCT}={P.PK}}
WHERE {OE.creationTime} > DATEADD(DAY,DATEDIFF(DAY,0, GETDATE())-1,0)
GROUP BY {P.PK},{OE.initialQuantiy}
ORDER BY orderedQuantity DESC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.