Hello community,
Im having a lot of trouble combining these two queries. Im close to graduating my college with a bachelors degree in database administration. However my strong point relies on MS SQL, now going back into SQL developer i have been struggling a bit. A classmate has provided me questions she receives in class and i appreciate it as a way to practice and improve my skills.
The question is this: (Note this is base of the "cityjails" table provided with the Oracle 11g SQL book by Joan Casteel)
List the names of probation officers who have had less than the average number of criminals assigned.
I created this so far, but im getting multiple names even though i added the distinct clause.
//
SELECT Distinct (FIRST ||' '|| LAST) AS "Probation Officers", A.CRIMINAL_ID, A.PROB_ID
FROM SENTENCES A
JOIN PROB_OFFICERS B ON
A.PROB_ID = B.PROB_ID
WHERE A.PROB_ID < (SELECT AVG(CRIMINAL_ID) FROM SENTENCES)
//
These are the results.

Any idea what im doing wrong?
Thank you.