11 lines
224 B
MySQL
11 lines
224 B
MySQL
|
-- Build the comments count column
|
||
|
|
||
|
UPDATE pages
|
||
|
SET commentCount = subquery.commentCount
|
||
|
FROM (
|
||
|
SELECT COUNT(commentHex) as commentCount
|
||
|
FROM comments
|
||
|
WHERE state = 'approved'
|
||
|
GROUP BY (domain, path)
|
||
|
) as subquery;
|