Some sql maintenance scripts in svn

main
Inga 🏳‍🌈 13 years ago
parent 17020218e8
commit f27731e66c
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Resources/FLocal/sql/find-wrong-board-threads-count.sql

@ -0,0 +1,2 @@
select b."Id", b."TotalThreads", t.cnt from "Boards" b join (select "BoardId", count(*) cnt 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."TotalThreads" != t.cnt;
select b."Id", b."TotalThreads", sb.total, t.cnt, sb.total + t.cnt from "Boards" b join (select "ParentBoardId", sum("TotalThreads") total from "Boards" group by "ParentBoardId") sb on sb."ParentBoardId" = b."Id" join (select "BoardId", count(*) cnt from "Threads" group by "BoardId") t on t."BoardId" = b."Id" where b."TotalThreads" != sb.total+t.cnt;
Loading…
Cancel
Save