English 中文(简体)
如何在具体一之后选定20个行
原标题:how to select 20 rows after specific one
  • 时间:2012-01-13 23:25:28
  •  标签:
  • mysql

well guys i have this table i sorted by date and all the id are mixed now and i selected 20 first rows then want to get another 20 rows after the last one to make is more clear : ( SELECT * FROM switch ORDER BY from_date ASC )

id  what    employee    from_date
55  1   11223   2012-01-26
69  3   30182   2012-01-12
67  3   12312   2031-01-12
68  3   12312   2031-01-12
65  3   12312   2031-01-12
6   3   12312   2031-01-12
64  3   12312   2031-01-12
63  3   12312   2031-01-12
**62    3   12312   2012-01-31**
60  3   30182   2012-01-18
61  3   30182   2012-01-18
59  3   30182   2012-01-18
57  3   30182   2012-01-18
58  3   30182   2012-01-18

now i want to get 20 rows from this table after id=62 the output should give me:

60  3   30182   2012-01-18
61  3   30182   2012-01-18
59  3   30182   2012-01-18
57  3   30182   2012-01-18
58  3   30182   2012-01-18
问题回答

不幸的是,我没有看到你重新命令的栏目,但是,这将为所有人服务。

SELECT *
FROM your_table_name
ORDER BY column_name ASC LIMIT 20, 20

This will return 20 rows after 20th row. In your case query will be:

SELECT * FROM switch ORDER BY from_date ASC LIMIT 20, 20

请进一步解释。 你试图从桌子上走什么? 如果您按日期顺序排列,我假定你正试图根据日期收集数据。 但是,你表示,希望id笑吗? 这或许是你所期待的......。

select top 20 * from [table] where [condition]
union all
select top 20 * from [table] where [condition]

- 行业、审判、审判!





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签