Home » RDBMS Server » Server Administration » HELP!! Newbie stuck...
HELP!! Newbie stuck... [message #373087] Mon, 26 March 2001 22:46
Chris
Messages: 128
Registered: November 1998
Senior Member
Using Oracle demo tables (and one or two others) trying to get display of customers with the highest and lowest total purchases. Can't figure out where to limit by MAX() or MIN(). Everything I try either displays all rows or fails (every possible common error message there is, I've gotten). Here's the query. Any help would be greatly appreciated.

1 SELECT name, area, phone, ename as "SALES REP", SUM(total) AS "TOTAL PURCHASES"
2 FROM demo.customer ca, demo.emp ea, demo.ord oa
3 WHERE ca.repid = ea.empno
4 AND oa.custid = ca.custid
5 AND 'TOTAL PURCHASES' = ALL
6 (SELECT MAX('TOTAL PURCHASES')
7 FROM demo.ord ob, demo.customer cb
8 WHERE oa.custid = ob.custid)
9* GROUP BY name, area, phone, ename, 'TOTAL PURCHASES'

Thank you!!
Previous Topic: Create a table with all the days between two days
Next Topic: Validate Form Against Access Database?
Goto Forum:
  


Current Time: Wed Jun 26 06:47:50 CDT 2024