由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - how to write this query, need help !!
相关主题
long and CLOB.. any differences?Questions about building a database(Maybe ACCESS?)
Does MS SQL 7 support SQL3 Datatype?the most stupid question
Is "Dim mydb as database" a user-defined datatypeMy SQL question: auto increment
questionimage datatype in sql server
question for webdb guru请大侠帮帮忙!SQL server error问题。
Help about mysqlbeijing呀,教教我怎么optimize sql server吧。
SQL问题求救!!Oracle char AND varchar2 datatype question.
有关m# sql server text字段类型一问Oracle Group and Index question
相关话题的讨论汇总
话题: query话题: write话题: age话题: rows话题: person
进入Database版参与讨论
1 (共1页)
o**k
发帖数: 5
1
In DB2 a table have a field called time ,
time is of timestamp datatype.
How to write a query to retrieve lateset
5 time entries?
for example table person have an age field,
create table person(
name varhar(20),
age timestamp
)
find the youngest 5 person.
Thank
s*****c
发帖数: 36
2
In DB2, you can specify to retrieve the only top n rows
using
"Optimizer for n rows" or "fetch first on rows only" or
both.
As for your example, you can write such a sql:
select name, age
from person
order by age asc
fetch first 5 rows only
or
select name, age
from person
order by age asc
optimizer for 5 rows
s*****c
发帖数: 36
3
~~optimize for 5 rows -- sorry, should be this
1 (共1页)
进入Database版参与讨论
相关主题
Oracle Group and Index questionquestion for webdb guru
Job openings with Teradata (zt)Help about mysql
Access database 求助SQL问题求救!!
请教ssis有关m# sql server text字段类型一问
long and CLOB.. any differences?Questions about building a database(Maybe ACCESS?)
Does MS SQL 7 support SQL3 Datatype?the most stupid question
Is "Dim mydb as database" a user-defined datatypeMy SQL question: auto increment
questionimage datatype in sql server
相关话题的讨论汇总
话题: query话题: write话题: age话题: rows话题: person