🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
3 messages
3 total messages Started by TR Thu, 12 Dec 2002 13:35
INSERT INTO with SELECT
#11234
Author: TR
Date: Thu, 12 Dec 2002 13:35
20 lines
1379 bytes
INSERT INTO PROJECTS
SELECT * FROM NEW_PROJECTS
WHERE NEW_PROJECTS.START_DATE > ��6-JUN-1994��;

I know the above can work. But my question is:

Can I add an "ORDER BY" to the SELECT? If yes, how? Something like:

INSERT INTO PROJECTS
SELECT * FROM NEW_PROJECTS
ORDER BY ...

doesn't work.

If not, what to do if I want to insert into one table with some rows from
another dataset which is somehow sorted?

Rgds!

TR@SOE
Re: INSERT INTO with SELECT
#11121
Author: Martijn Tonies
Date: Fri, 13 Dec 2002 14:10
66 lines
2954 bytes
> Thank you for all your valuable input. I have been developing database
> application for years so I am not that newbie.
>
> Maybe I did not put my question very clear so everyone is confused with my
> intention. Let met put it this way:
>
> Let's say PROJECTS is a table created from an external file: abc.txt. While
> NEW_PROJECTS is a corresponding internal table. After some manipulation in
> the NEW_PROJECTS table, I want to export the changes made back to the
> PROJECTS table (and thus reflect the change in abc.txt). Then my concern to
> export the data in a certain order makes perfect sense.

If you're using the data in the external table in an ordered way OUTSIDE IB,
yes.

If you want it ordered INSIDE IB, simply use an ORDER BY clause.

As for the problem, I think the only way to get this ordered would be to select
from a stored procedure that has an ORDER BY clause in it's select ( I haven't
tried it though).


--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

> Tks for any input.
>
> TR@SOE
>
>
> "TR@SOE" <tr@netease.com> д����Ϣ����:3df890a9@newsgroups.borland.com...
> > INSERT INTO PROJECTS
> > SELECT * FROM NEW_PROJECTS
> > WHERE NEW_PROJECTS.START_DATE > ��6-JUN-1994��;
> >
> > I know the above can work. But my question is:
> >
> > Can I add an "ORDER BY" to the SELECT? If yes, how? Something like:
> >
> > INSERT INTO PROJECTS
> > SELECT * FROM NEW_PROJECTS
> > ORDER BY ...
> >
> > doesn't work.
> >
> > If not, what to do if I want to insert into one table with some rows from
> > another dataset which is somehow sorted?
> >
> > Rgds!
> >
> > TR@SOE
> >
> >
>
>
Re: INSERT INTO with SELECT
#11127
Author: TR
Date: Sat, 14 Dec 2002 03:29
32 lines
1703 bytes
I know SP can do this.

But I am just curious when IB is developing the INSERT & SELECT and put the
external table into consideration, there seemed to have something
overlooked.

Rgds!

TR@SOE


"Martijn Tonies" <m.tonies@upscene_remove.com> д����Ϣ����
:3df9e991$1@newsgroups.borland.com...
>
>
> As for the problem, I think the only way to get this ordered would be to
select
> from a stored procedure that has an ORDER BY clause in it's select ( I
haven't
> tried it though).
>
>
> --
>
> With regards,
>
> Martijn Tonies
> InterBase Workbench - the developer tool for InterBase & Firebird
> Firebird Workbench - the developer tool for Firebird
> Upscene Productions
> http://www.upscene.com
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads