BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Special SQL query

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Michel Larouche
Guest





PostPosted: Fri Jan 23, 2004 7:55 pm    Post subject: Special SQL query Reply with 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
Bill Todd (TeamB)
Guest





PostPosted: Fri Jan 23, 2004 9:34 pm    Post subject: Re: Special SQL query Reply with 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





PostPosted: Tue Jan 27, 2004 2:10 pm    Post subject: Re: Special SQL query Reply with quote



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





PostPosted: Tue Jan 27, 2004 2:27 pm    Post subject: Re: Special SQL query Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.