我想多次重复使用子查询。
首先计算
---
title: "Untitled"
author: "John Doe"
date: "November 18, 2016"
documentclass: article
output:
bookdown::pdf_document2:
toc: yes
fig_caption: yes
number_sections: yes
linkcolor: blue
---
# Chapter One
```{r a, fig.cap="rabble rabble"}
plot(cars) # a scatterplot
```
```{r b, fig.cap="rabble rabble"}
plot(cars) # a scatterplot
```
# Chapter Two
# (APPENDIX) Appendix {-}
# Appendix A
```{r c, fig.cap="rabble rabble"}
plot(cars) # a scatterplot
```
# Appendix B
```{r d, fig.cap="rabble rabble"}
plot(cars) # a scatterplot
```
子查询,如
devices = db.session.query(subquery).count()
然后用限制对结果进行分页。我想重用我的过滤器
(Device, User).\
filter(Device.e=='E').\
filter(Device.id==User.id
并且不要重复,因为我使用了这么多的过滤器和过滤器可能会改变
答案 0 :(得分:0)
答案实际上非常简单。
def getquery(self):
return db.session.query(subquery)
为计数
count = self.getquery().count()
限制
devices = self.getquery().limit(xxxx)