I need to be able to return all the judges in CMPJUDNM even when there is no corresponding data in CMPHERMF. I thought that a left or right join would work, but I think since I'm using aggregate functions it's not working as I expected.
does anyone know if this is possible in a query?
thanks!
leslie
Code:
SELECT J.JUDCOD, J.JUDNAM, H.DISPO, COUNT(H.DISPO)
FROM CMPJUDNM J
LEFT OUTER JOIN CMPHERMF H ON J.JUDCOD = H.JUDCOD
GROUP BY J.JUDCOD, J.JUDNAM, H.DISPO
CMPJUDNM:
JUDCOD JUDNAM
1 Victor Valdez
2 Kevin Fitzwater
3 Cristina Jaramillo
CMPHERMF
CASPRE CASNUM DISPO JUDCOD
CR 123405 GU 1
CR 123505 NG 1
TR 32105 DI 1
TR 32305 GU 1
CR 321405 GU 3
CR 456505 NG 3
DW 98704 DE 3
So my results would be:
1 Victor Valdez GU 2
1 Victor Valdez NG 1
1 Victor Valdez DI 1
2 Kevin Fitzwater
3 Cristina Jaramillo GU 1
3 Cristina Jaramillo NG 1
3 Cristina Jaramillo DE 1
does anyone know if this is possible in a query?
thanks!
leslie