 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michel Larouche Guest
|
Posted: Fri Jan 23, 2004 7:55 pm Post subject: Special SQL query |
|
|
I search a way to get the Last X record of a table....
Ex:
Table name = Example
Field name = Values
And value = 1,2,3,4,5,6,7,8,9,10
Select Top 2 Values FROM Example = 1,2
Select Top 2 Values FROM Example Order by Values DESC = 10,9
I search a way to get the result of the second query but in ASC order....
(9,10)
Any way to create a Query Like
Select Values From Example
Where Values >= ( Select Min (Select Top 2 Values From Example Order by
Values DESC) From Example )
thanks for your help...
Michel
|
|
| Back to top |
|
 |
Bill Todd (TeamB) Guest
|
Posted: Fri Jan 23, 2004 9:34 pm Post subject: Re: Special SQL query |
|
|
It is very difficult to answer database questions when you do not tell
us what database you are using.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Michel Larouche Guest
|
Posted: Tue Jan 27, 2004 2:10 pm Post subject: Re: Special SQL query |
|
|
it's a simple Ms Access database.....
"Bill Todd (TeamB)" <no (AT) no (DOT) com> a écrit dans le message de
news:9q4310hcdbmv0mf94dkj3q5s4khfl981fj (AT) 4ax (DOT) com...
| Quote: | It is very difficult to answer database questions when you do not tell
us what database you are using.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Michel Larouche Guest
|
Posted: Tue Jan 27, 2004 2:27 pm Post subject: Re: Special SQL query |
|
|
I found the way....
This is my real query..
SELECT Top 80 HeureFrom, ..... From Demarrage ORDER BY DateHeure DESC
After i change the sort order of the recordset.
RecordSet.Sort := 'DateHeure ASC';
thanks to all...
Michel
"Michel Larouche" <NoSpam_michel.larouche (AT) devicom (DOT) com> a écrit dans le
message de news:40117c3b$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I search a way to get the Last X record of a table....
Ex:
Table name = Example
Field name = Values
And value = 1,2,3,4,5,6,7,8,9,10
Select Top 2 Values FROM Example = 1,2
Select Top 2 Values FROM Example Order by Values DESC = 10,9
I search a way to get the result of the second query but in ASC order....
(9,10)
Any way to create a Query Like
Select Values From Example
Where Values >= ( Select Min (Select Top 2 Values From Example Order by
Values DESC) From Example )
thanks for your help...
Michel
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|