#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    20
    Rep Power
    0

    Unhappy Nested Query Problem..driving me nuts :-/


    Table DRIVINGHISTORY
    HISTORYID NOT NULL NUMBER(4)
    EMPLOYEEID NOT NULL NUMBER(4)
    OFFENCENO NOT NULL VARCHAR2(10)
    OFFENCETYPE NOT NULL VARCHAR2(20)
    OFFENCEDATE NOT NULL DATE
    DEMERITPOINT NOT NULL NUMBER(2)

    TABLE DRIVER
    EMPLOYEEID NOT NULL NUMBER(4)
    FNAME NOT NULL VARCHAR2(15
    LNAME NOT NULL VARCHAR2(20
    DATEJOINED NOT NULL DATE
    YEAREXPERIENCE NOT NULL NUMBER(2)
    LICENCENO NOT NULL VARCHAR2(10
    LICENCECLASS NOT NULL CHAR(2)
    PHONENO NOT NULL CHAR(12)

    I'm to list Employee ID, First and last name and Total of thier demerit points for those employees whose demerit points are greater than 9.

    Any help would be greatly appreciated.
    Last edited by ratumeli; October 26th, 2003 at 05:42 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,375
    Rep Power
    391
    Code:
    select d.EMPLOYEEID , d.FNAME , d.LNAME , sum(dh.DEMERITPOINT )
    from DRIVINGHISTORY as dh , DRIVER  as d
    where dh.EMPLOYEEID = d.EMPLOYEEID 
    group by d.EMPLOYEEID , d.FNAME , d.LNAME
    having sum(dh.DEMERITPOINT ) > 9
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    20
    Rep Power
    0
    thanks again...swampboogie.

IMN logo majestic logo threadwatch logo seochat tools logo