Subject | Re: INSERT INTO...SELECT...ORDER BY |
---|---|
Author | uwekeim |
Post date | 2004-01-22T10:05:50Z |
--- In firebird-support@yahoogroups.com, "Svein Erling"
<svein.erling.tysvaer@k...> wrote:
is not very good):
I have an application, that builds a tree-structure based on a db-
table, connected via ODBC. Unfortunately I can't change this
application.
This app builds the tree ordered by a keynumber (ID). Because I want
this tree to be ordered by the manufacturer-names, the ID must be
assigned to the names ordered same way - I hope You see what I mean.
So I built a generator to generate the ID and a "on-insert"-trigger
into the manufacturer-table.
Before starting the app, I clear the table, set the generator to 0
and insert the ordered records from another table, which contains the
articles of several
manufactureres . As result i get the ID ordered
by names.
Do You know a better way to solve this task?
<svein.erling.tysvaer@k...> wrote:
> --- In firebird-support@yahoogroups.com, "uwekeim" wrote:clothes
> > Hello,
> >
> > I want to insert some ordered records into an empty table, but
> > Firebird seems not to support "ORDER BY" in an insert-clause (why
> > not???).
> >
> > Is there any workaround?
>
> In theory, there is no such thing as an order amongst the stored
> records of Firebird. You may ask for ordered records when you take
> them out of the database (SELECT... ORDER BY...), but within the
> database there is approximately as much order as amongst the
> within a washing machine. You may find there to be a certain orderwhat I
> ('hey, I inserted these records in this order, and it is almost
> get out without any order by clause'), but I would not trust anysuch
> accidental ordering unless someone deep into the source code toldme
> it was safe. You'd better use indexes and order your data whentaking
> them out of the database.hmmm...let me try to explain what I'm going to to (sorry, my english
>
> Set
is not very good):
I have an application, that builds a tree-structure based on a db-
table, connected via ODBC. Unfortunately I can't change this
application.
This app builds the tree ordered by a keynumber (ID). Because I want
this tree to be ordered by the manufacturer-names, the ID must be
assigned to the names ordered same way - I hope You see what I mean.
So I built a generator to generate the ID and a "on-insert"-trigger
into the manufacturer-table.
Before starting the app, I clear the table, set the generator to 0
and insert the ordered records from another table, which contains the
articles of several
manufactureres . As result i get the ID ordered
by names.
Do You know a better way to solve this task?