11 lines
224 B
SQL
11 lines
224 B
SQL
-- 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;
|