从一列中获取五行/数据的SQL查询?
答案 0 :(得分:2)
SELECT columnName FROM Table LIMIT 5
或
SELECT columnName FROM Table WHERE anotherColumn = somevalue LIMIT 5
或者
SELECT columnName FROM Table WHERE anotherColumn = somevalue ORDER BY columnName1 asc LIMIT 5
答案 1 :(得分:0)
SQL SERVER
SELECT TOP 5 ColumnName FROM TableName;
答案 2 :(得分:0)
我认为ORDER BY在最终确定5条记录方面发挥了重要作用
SELECT columnName FROM Table order by ID desc LIMIT 5