From 87cd11921617e620342a034189867fb49955cf52 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 24 Apr 2020 19:17:35 +1000 Subject: [PATCH] fix use counts not including unused note types --- rslib/src/storage/notetype/get_use_counts.sql | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/rslib/src/storage/notetype/get_use_counts.sql b/rslib/src/storage/notetype/get_use_counts.sql index cc667ce4d..dce0bdca1 100644 --- a/rslib/src/storage/notetype/get_use_counts.sql +++ b/rslib/src/storage/notetype/get_use_counts.sql @@ -1,15 +1,10 @@ select - mid, - ( - select - name - from notetypes nt - where - nt.id = mid - ) as name, - count(id) -from notes + nt.id, + nt.name, + count(n.id) +from notetypes nt +left join notes n on (n.mid = nt.id) group by - mid + nt.id order by - name \ No newline at end of file + nt.name \ No newline at end of file