SQL - Multiplying columns

100 views Asked by At

I cannot get this to work

SELECT PM.PMNUM, (COUNT(ROUTE_STOP.LOCATION) * JOBPLAN.JPDURATION) 
FROM PM
LEFT OUTER JOIN ROUTE_STOP ON ROUTE_STOP.ROUTE = PM.ROUTE
LEFT OUTER JOIN JOBPLAN ON JOBPLAN.JPNUM = PM.JPNUM
GROUP BY PM.PMNUM
1

There are 1 answers

2
Ionic On BEST ANSWER

As I see your minimum missing a group by.

SELECT PM.PMNUM, (COUNT(ROUTE_STOP.LOCATION) * JOBPLAN.JPDURATION) 
FROM PM
LEFT OUTER JOIN ROUTE_STOP ON ROUTE_STOP.ROUTE = PM.ROUTE
LEFT OUTER JOIN JOBPLAN ON JOBPLAN.JPNUM = PM.JPNUM
GROUP BY PM.PMNUM, JOBPLAN.JPDURATION

If this won't help you need to give further feedback what is not working?