parent
f27731e66c
commit
fff6e037c9
@ -0,0 +1,2 @@ |
||||
select b."Id", b."TotalPosts", t.total from "Boards" b join (select "BoardId", sum("TotalPosts") total from "Threads" group by "BoardId") t on t."BoardId" = b."Id" where (select count(*) from "Boards" sb where sb."ParentBoardId" = b."Id") = 0 and b."TotalPosts" != t.total; |
||||
select b."Id", b."TotalPosts", sb.total, t.total, sb.total + t.total from "Boards" b join (select "ParentBoardId", sum("TotalPosts") total from "Boards" group by "ParentBoardId") sb on sb."ParentBoardId" = b."Id" join (select "BoardId", sum("TotalPosts") total from "Threads" group by "BoardId") t on t."BoardId" = b."Id" where b."TotalPosts" != sb.total+t.total; |
Loading…
Reference in new issue