摘要: 聚合查询 group by 整表聚合 In [1]: from django.db.models import * In [2]: from bookstore.models import Book In [3]: b1=Book.objects.aggregate(res=Count('price 阅读全文
posted @ 2021-08-12 19:48 yescarf 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 应用场景(F标记字段而非取值) 资源竞争的情况,F对象可以解决并发问题 字段之间的比较 In [1]: from bookstore.models import Book In [2]: from django.db.models import F In [3]: book=Book.objects 阅读全文
posted @ 2021-08-12 10:05 yescarf 阅读(66) 评论(0) 推荐(0) 编辑