繁体   English   中英

使用python 27仅检索SQLITE中一行的最后一个值

[英]Retrieve Only the last values of a row in SQLITE with python 27

我正在使用此代码从sqlite行获取所有数据,但我只想检索最后30个条目。

import sqlite3
from matplotlib import pyplot
fig = pyplot.figure()

con = sqlite3.connect('growll.db')
con.text_factory = str
cur = con.cursor()
cur.execute("select temp from GrowLLDados")
ar=[r[0] for r in cur.fetchall()]

类似于"select temp from GrowLLDados ORDER BY id DESC LIMIT 30"

其中id是一个自动递增计数器,或者至少意味着数字越大,条目越新...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM