- sec_centres,NULLIF(structures,0) AS structures,dists,last_covop,
- u.username,max_bank_hack(metal,crystal,eonium,p.value,(SELECT value FROM
- current_planet_stats WHERE id = ?)) AS MaxResHack, planet_status, relationship
- FROM covop_targets c JOIN current_planet_stats p ON p.id = c.planet
- LEFT OUTER JOIN users u ON u.uid = c.covop_by) AS foo
- $where});
+ seccents,NULLIF(ss.total,0) AS structures,distorters
+ ,max_bank_hack(metal,crystal,eonium,p.value
+ ,(SELECT value FROM current_planet_stats WHERE id = ?)) AS MaxResHack
+ , planet_status, relationship
+ FROM current_planet_stats p
+ LEFT OUTER JOIN planet_scans ps ON p.id = ps.planet
+ LEFT OUTER JOIN structure_scans ss ON p.id = ss.planet
+ ) AS foo
+ WHERE (metal IS NOT NULL OR seccents IS NOT NULL)
+ $where
+ });