Build precise queries to find exactly what you need
Press ESC to close
@adalle
Favorites0
Views
Projects0
I have this working well with Postgres. A couple minor changes from the previous suggested changes: $sql_query = "SELECT SUM(JobErrors) AS errors, COUNT(*) AS count, Job.JobId, Job.JobStatus, Log.LogText FROM Job LEFT JOIN Log on Job.JobId = Log.JobId WHERE (Name='$opt_job') AND (JobStatus='T') AND (EndTime IS NOT NULL) AND ((EndTime >= '$date_stop')) GROUP BY Job.JobId, Job.JobStatus, Log.LogText;"; (EndTime >= as opposed to =) When there isn't a match, you don't get an array of 0's or nulls, but just an empty array. So I check for that: if ($#job_stats == -1) { @job_stats = (0,0,0,0) } This is the easiest fix; the rest of the code expects that array to exist, so I just set it to zeroes.
Reviewed 10 years ago