-4

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
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    1) Are you *sure* you want to use outer joins on this? 2) What happens when you execute this query? Is there an error, or are the results not what you expected, or do choirs of angels sing "Hallelujah", or what? 3) Please edit your question and provide sample table contents, expected output, and the output you're getting. Thanks. – Bob Jarvis - Слава Україні Jun 18 '15 at 11:09
  • Providing sample data and desired results *as well as* explaining the error would make your question more understandable. – Gordon Linoff Jun 18 '15 at 11:29

1 Answers1

-1

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?

Ionic
  • 3,884
  • 1
  • 12
  • 33