Beiträge von Cyperghost im Thema „PDOException Fehler bei Update auf Version 5.4.2 pl2“

    Leider liefert SUM dummerweise NULL zurück und nicht 0, dadurch passiert dieser Fehler.


    Für bitte folgenden SQL Query vor dem Update aus, dann sollte das ganze Funktionieren :)

    SQL
    UPDATE news1_news news SET news.comments = (
        SELECT COALESCE(SUM(commentsTable.responses),0) + COUNT(*)
        FROM wcf1_comment commentsTable 
        RIGHT JOIN wcf1_object_type objectType 
            ON (commentsTable.objectTypeID = objectType.objectTypeID AND objectType.objectType = 'de.wbb-elite.news.comment')
        RIGHT JOIN wcf1_object_type_definition objectTypeDefinition 
            ON (objectTypeDefinition.definitionID = objectType.definitionID AND objectTypeDefinition.definitionName = 'com.woltlab.wcf.comment.commentableContent')
        WHERE commentsTable.objectID = news.newsID
    ) WHERE news.comments IS NULL