Skip to Content
Former Member
Nov 15, 2016 at 03:10 PM

Query for most ordered products


Hi , we were working on a query to find the most ordered products in descending order but however query is not working and giving missing '}' for '{' error. Could someone please suggest solutions. Here is the query:

select {p1:code} from {Myproduct as p1} join {SELECT {P.CODE} as p1code,COUNT({P.code}) as tcount FROM { order AS O JOIN orderentry AS OE ON {OE.order} = {} JOIN Myproduct AS P ON {OE.product} = {} }
GROUP BY {P.CODE}} as p2 on {p2:p1code}={p1:code} order by {p2.tcount} desc