选择第一个和最后一个元素的最有效方法,SQLite? [英] Most efficient way to select 1st and last element, SQLite?
本文介绍了选择第一个和最后一个元素的最有效方法,SQLite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从SQLite的列中仅选择第一个和最后一个元素的最有效方法是什么?
What is the most efficient way to select the first and last element only, from a column in SQLite?
推荐答案
行中的第一个和最后一个元素?
The first and last element from a row?
SELECT column1, columnN
FROM mytable;
我认为您必须指的是列的第一个和最后一个元素:
I think you must mean the first and last element from a column:
SELECT MIN(column1) AS First,
MAX(column1) AS Last
FROM mytable;
有关MIN()
,请参见 http://www.sqlite.org/lang_aggfunc.html 和MAX()
.
See http://www.sqlite.org/lang_aggfunc.html for MIN()
and MAX()
.
我正在使用First
和Last
作为列别名.
I'm using First
and Last
as column aliases.
这篇关于选择第一个和最后一个元素的最有效方法,SQLite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文