|
From: Kevin on 12 Jul 2008 16:23 Hi, how to get the last 20 rows only in one column contain 1000 rows
From: John Spencer on 12 Jul 2008 19:18 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
From: Kevin on 14 Jul 2008 01:24 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 >
From: John Spencer on 14 Jul 2008 07:15 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
|
Pages: 1 Prev: Problems with the 'table of contents' tool Next: What SharePoint do you want to use? |