I am having this query :
SELECT T.custno,T.custlastname,AVG(T.OrderAmount) , T.OrderCount
FROM(
SELECT A.custno,A.custlastname,count(b.ordno) as OrderCount, sum(c.qty*d.prodprice) AS OrderAmount
FROM customer A
JOIN ordertbl B ON A.custno=b.custno
JOIN ordline C ON b.ordno=c.ordno
JOIN product D ON c.prodno=d.prodno
WHERE A.custstate='CO'
GROUP BY A.custno,A.custlastname, b.ordno) AS T
GROUP BY T.custno,T.custlastname;
I get this error :
ORA-00933: SQL command not properly ended
When i execute inner subquery explicitly, it runs fine. Please let me know the reason.
One can try at http://ift.tt/1fbp56t
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire