| |

VerySource

 Forgot password?
 Register
Search
View: 24|Reply: 10

There are 10 records in a table. How to extract the 5th to 8th data without using the id number?

[Copy link]

2

Threads

6

Posts

6

Credits

Newbie

Rank: 1

Credits
6

 China

Post time: 2020-3-9 12:30:01
| Show all posts |Read mode
There are 10 records in a table. How to extract the 5th to 8th data without using the id number?
Reply

Use magic Report

0

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-4-13 17:15:01
| Show all posts
Anyway, only 10 full reading, program processing
Reply

Use magic Report

0

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-4-13 17:30:01
| Show all posts
Only 10, full read, code processing
Reply

Use magic Report

0

Threads

8

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-4-13 22:00:01
| Show all posts
SQL Server: select top 4 * from (select top 8 * from table a where not exists (select top 4 * from table columns_A = a.columns_A))
Oracle: select * from table where rownum between 5 and 8
____________________________________
...
Probably that's it
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-4-30 01:30:01
| Show all posts
select top m, n from XXX
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-5-30 22:45:01
| Show all posts
A good solution to this problem with cursors is that they are not efficient. Is there anything better?
Reply

Use magic Report

0

Threads

95

Posts

56

Credits

Newbie

Rank: 1

Credits
56

 China

Post time: 2020-6-1 11:45:01
| Show all posts
Read it out one by one with DataReader ..

or

The data is put into a DataTable, and then the data in the DataTable is fetched ..

Comments are for reference only.
Reply

Use magic Report

0

Threads

20

Posts

15

Credits

Newbie

Rank: 1

Credits
15

 LAN

Post time: 2020-6-1 19:00:01
| Show all posts
Take 8 heads, in reverse row Take 3 heads (do not reverse up with you)
^^^^^^^^^^^^^^^^^
Simple questions are easy to do ~! :)
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-6-1 19:45:01
| Show all posts
First, top order 8 and then top 4, then it ’s OK. Do you still need to write SQL?
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-6-2 08:45:02
| Show all posts
Set the logical page size, 4 records per page, just take the record on page 2
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list