mysql fails at count() = 0
This commit is contained in:
		
							parent
							
								
									d850a562db
								
							
						
					
					
						commit
						2f045fd944
					
				@ -94,7 +94,12 @@ class AdminPage implements Extension {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private function recount_tag_use() {
 | 
						private function recount_tag_use() {
 | 
				
			||||||
		global $database;
 | 
							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() {
 | 
						private function purge_unused_tags() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user