mysql fails at count() = 0

This commit is contained in:
Shish 2009-07-28 01:19:40 +01:00
parent d850a562db
commit 2f045fd944

View File

@ -94,7 +94,12 @@ class AdminPage implements Extension {
private function recount_tag_use() {
global $database;
$database->Execute("UPDATE tags SET count=(SELECT COUNT(image_id) FROM image_tags WHERE tag_id=tags.id GROUP BY tag_id)");
$database->Execute("
UPDATE tags
SET count = COALESCE(
SELECT COUNT(image_id) FROM image_tags WHERE tag_id=tags.id GROUP BY tag_id,
0
)");
}
private function purge_unused_tags() {