If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Show Last 20 rows
Hi,
how to get the last 20 rows only in one column contain 1000 rows |
#2
|
|||
|
|||
Show Last 20 rows
First, define the last twenty rows? Data is not stored in any specific
order. If you want the last 20 rows there must be something in a field (or fields) that specifies that this row is one of the last 20? Another way to think about that is there must be a field or fields that you can sort by that will put the records in an order so that the last 20 rows can be picked. Take a look at using TOP 20 in a query that orders the rows in the manner you want. An SQL statement to do this might look like the following: SELECT Top 20 * FROM YourTable ORDER BY EntryDateTimeField, PrimaryKeyField '================================================= === John Spencer Access MVP 2002-2005, 2007-2008 The Hilltop Institute University of Maryland Baltimore County '================================================= === Kevin wrote: Hi, how to get the last 20 rows only in one column contain 1000 rows |
#3
|
|||
|
|||
Show Last 20 rows
Hi,
Thanks for advise....! but still can't understand...? below is the table i using to colect measurement data. i just want get the latest 5 measurement only meaing from 5 to 10 row. Please advise id | Measure | ----------------- 1 0.45 2 0.50 3 0.41 4 0.42 5 0.40 6 0.30 7 0.46 8 0.42 9 0.43 10 0.40 "John Spencer" wrote: First, define the last twenty rows? Data is not stored in any specific order. If you want the last 20 rows there must be something in a field (or fields) that specifies that this row is one of the last 20? Another way to think about that is there must be a field or fields that you can sort by that will put the records in an order so that the last 20 rows can be picked. Take a look at using TOP 20 in a query that orders the rows in the manner you want. An SQL statement to do this might look like the following: SELECT Top 20 * FROM YourTable ORDER BY EntryDateTimeField, PrimaryKeyField '================================================= === John Spencer Access MVP 2002-2005, 2007-2008 The Hilltop Institute University of Maryland Baltimore County '================================================= === Kevin wrote: Hi, how to get the last 20 rows only in one column contain 1000 rows |
#4
|
|||
|
|||
Show Last 20 rows
Open a new query in design view (the query grid)
Add your table Add ID and Measure to the fields Sort by ID in descending order Double click on a blank area of the top section You should see Query Properties sheet Change Top Values to 5 (if you want the top 5) John Spencer Access MVP 2002-2005, 2007-2008 The Hilltop Institute University of Maryland Baltimore County Kevin wrote: Hi, Thanks for advise....! but still can't understand...? below is the table i using to colect measurement data. i just want get the latest 5 measurement only meaing from 5 to 10 row. Please advise id | Measure | ----------------- 1 0.45 2 0.50 3 0.41 4 0.42 5 0.40 6 0.30 7 0.46 8 0.42 9 0.43 10 0.40 "John Spencer" wrote: First, define the last twenty rows? Data is not stored in any specific order. If you want the last 20 rows there must be something in a field (or fields) that specifies that this row is one of the last 20? Another way to think about that is there must be a field or fields that you can sort by that will put the records in an order so that the last 20 rows can be picked. Take a look at using TOP 20 in a query that orders the rows in the manner you want. An SQL statement to do this might look like the following: SELECT Top 20 * FROM YourTable ORDER BY EntryDateTimeField, PrimaryKeyField '================================================= === John Spencer Access MVP 2002-2005, 2007-2008 The Hilltop Institute University of Maryland Baltimore County '================================================= === Kevin wrote: Hi, how to get the last 20 rows only in one column contain 1000 rows |
Thread Tools | |
Display Modes | |
|
|