Hi Stan,
maybe you can try first to find only the PrimaryKeys of the records you want to sum, then you can sum the containerNetWeight for those records.
query_sum = "SELECT SUM(containerNetWeight) FROM SQL_containers WHERE PrimaryKey IN (SELECT max(PrimaryKey) FROM SQL_containers GROUP BY containerNumber)"
regards