Hoe can I do following thing without using a VIEW from one Query.
!--CREATE THE VIEW
CREATE OR REPLACE VIEW BDGTMGR
AS
SELECT MANAGERID,SUM(BUDGET) AS BDGT FROM
N_DEPT GROUP BY MANAGERID ;
!-- THEN GET RESULT FROM THE VIEW
SELECT MANAGERID FROM BDGTMGR WHERE BDGT = (select MAX(BDGT) FROM BDGTMGR);
Here N_DEPT is may original Table which has columns named DID, MANAGERID and BUDGET.
I want to get MANAGERID who controls Maximum Budget. A Manager can control more than one Department. DID is the primary key for this table.
How can I do this?