Sorry, but your answer is not correct.
FROM ()
and does NOT include ORDER BY ...
--> your insert select will fail with syntax error
Ohh, OK
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Sven Köhler wrote:
>
> > declare ordertab cursor for select col1 from table2 order by col1
> > +
> > insert into table1 (col2) select * from ordertab
>
> The same is also possible with sub-selects:
>
> INSERT INTO table1(col2) SELECT * FROM
> (SELECT col1 FROM table2 ORDER BY col1)
>
> So
declare ordertab cursor for select col1 from table2 order by col1
+
insert into table1 (col2) select * from ordertab
The same is also possible with sub-selects:
INSERT INTO table1(col2) SELECT * FROM
(SELECT col1 FROM table2 ORDER BY col1)
Sorry i bothered you with this.
--
MaxDB Discussion
news [mailto:[EMAIL PROTECTED] Behalf Of Sven Köhler wrote:
> hi,
>
> i tried to insert something like
>
> INSERT INTO table1(col2)
> SELECT col1 FROM table2
> ORDER BY col1
>
> but according to the grammer ORDER BY is not allowed.
> well, you could say that the order of the rows doesn't matter
Sven wrote:
> i tried to insert something like
>
> INSERT INTO table1(col2)
> SELECT col1 FROM table2
> ORDER BY col1
>
> but according to the grammer ORDER BY is not allowed.
> well, you could say that the order of the rows doesn't matter, but it
> does. Imagine you've got a SERIAL-column in ta