about annotations over fk join
This commit is contained in:
commit
b4dbf933cd
28
cdf_meta_analogous_queries
Normal file
28
cdf_meta_analogous_queries
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
1 model
|
||||||
|
Journal
|
||||||
|
refereed
|
||||||
|
|
||||||
|
2 model
|
||||||
|
Article
|
||||||
|
doctype
|
||||||
|
journal
|
||||||
|
|
||||||
|
|
||||||
|
Journal.objects.values('refereed').annotate(co_ref=Count('id', distinct=True), co_doctypes=Count('articles__doctype', distinct=True))
|
||||||
|
|
||||||
|
|
||||||
|
Journal.objects.values('articles__doctype', 'refereed').annotate(doc_counts=Count('articles__doctype'))
|
||||||
|
|
||||||
|
|
||||||
|
1 model
|
||||||
|
File
|
||||||
|
experiment
|
||||||
|
|
||||||
|
2 model
|
||||||
|
FileAttribute
|
||||||
|
title
|
||||||
|
file
|
||||||
|
|
||||||
|
File.objects.values('experiment').annotate(co_exp=Count('id', distinct=True), co_titles=Count('attributes__title', distinct=True))
|
||||||
|
|
||||||
|
File.objects.values('attributes__title, 'experiment').annotate(title_counts=Count('attributes__title'))
|
Loading…
x
Reference in New Issue
Block a user