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 

An issue with sorted queries

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
Saurabh Lahoti
Guest





PostPosted: Mon Jun 27, 2005 3:48 pm    Post subject: An issue with sorted queries Reply with quote




I had created a database table that had a few columns which were to hold strings. My application populates this particular table, and when I go to query the database the data is returned in alphabetical order. I am using a TQuery component and a SELECT statement to perform this query. I am not using the ORDER BY clause and do not want the result of the query to be alphabetized. In fact, I simply want the data to be retrieved in the order that it was entered. Is thier any way to prevent the result set from being alphabetized ?
Back to top
Jayme Jeffman Filho
Guest





PostPosted: Mon Jun 27, 2005 7:02 pm    Post subject: Re: An issue with sorted queries Reply with quote



Hi Saurabh ,

If you do not set any order you can not control the order
the records are presented. So you must use "ORDER BY".

I don't know any way you can trust to sort the records on
the creation order, it depends on the database system you
are using, for example : On Oracle, the records which are
in the server memory cache are shown first .

If I may, I'd suggest you creating a column of integer data
type and set its value according to the creation order, and
then sort the records on that column.

HTH

Jayme.

"Saurabh Lahoti" <slahoti (AT) lexmark (DOT) com> escreveu na mensagem
news:42c01fc9$1 (AT) newsgroups (DOT) borland.com...
Quote:

I had created a database table that had a few columns which were to hold
strings. My application populates this particular table, and when I go to

query the database the data is returned in alphabetical order. I am using a
TQuery component and a SELECT statement to perform this query. I am not
using the ORDER BY clause and do not want the result of the query to be
alphabetized. In fact, I simply want the data to be retrieved in the order
that it was entered. Is thier any way to prevent the result set from being
alphabetized ?



Back to top
Antonio Felix
Guest





PostPosted: Mon Jun 27, 2005 10:44 pm    Post subject: Re: An issue with sorted queries Reply with quote




"Saurabh Lahoti" <slahoti (AT) lexmark (DOT) com> wrote:
Quote:

I had created a database table that had a few columns which were to hold strings. My application populates this particular table, and when I go to query the database the data is returned in alphabetical order. I am using a TQuery component and a SELECT statement to perform this query. I am not using the ORDER BY clause and do not want the result of the query to be alphabetized. In fact, I simply want the data to be retrieved in the order that it was entered. Is thier any way to prevent the result
set from being alphabetized ?

Hi Saurabh,

In addition to what Jayme have said, if you use Paradox either
by calling Append or Insert the new Record is always stored into
the Dataset in a position based on its primary index.
If that applies to you, then your query will be ordered by
the primary key field even if you don't use any Order by clause.

Br
Antonio

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder 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.