我希望在MySQL的前n行中从表中得到min(somecolumn)。获得结果的最佳查询是什么?
到目前为止我找到了
Dim files = Directory.GetFiles("C:\path", "*.*", SearchOption.AllDirectories)
.Where(Function(s) s.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase)
OrElse s.EndsWith(".wmv", StringComparison.OrdinalIgnoreCase))
答案 0 :(得分:0)
select min(t.columnName) from tableName as t limit 10
(此处n限制为前10行为例)
OR
select outerTable.columnName from (select distinct t.columnName from tableName as t order by t.columnName asc limit 10) as outerTable limit 1,1
答案 1 :(得分:0)
尝试以下语法:
SELECT min(columname) FROM tablename limit n