Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Problem with derived table
Mon, Dec 8 2008 5:09 AMPermanent Link

UliBecker
This code works:

<
 select PatientenID, list(cast(datum as varchar))
 from (select distinct ScheineID,PatientenID,datum from anforderungen order by datum )
 as AnforderungenTemp group by patientenid
>

while this doesn't:

<
 insert into ReportKasseScheine
 select PatientenID, list(cast(datum as varchar))
 from (select distinct ScheineID,PatientenID,datum from anforderungen order by datum )
 as AnforderungenTemp group by patientenid
>

It says: "ElevateDB Error #700 An error was found in the statement at line 4 and column 73 (Expected ) but instead found order)".

I am using the derived table to order the date in the list.

Regards Uli
Mon, Dec 8 2008 12:03 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

The problem is the ORDER BY clause - it's not allowed in this context.
Anyway, just for curiosity, why would you care for the order of the
inserted rows?

--
Fernando Dias
[Team Elevate]
Mon, Dec 8 2008 12:32 PMPermanent Link

Uli Becker
Fernando,

> The problem is the ORDER BY clause - it's not allowed in this context.

I guessed that.

> Anyway, just for curiosity, why would you care for the order of the
> inserted rows?

Please note that the "order by"-clause does NOT refer to the order of
the inserted records. It's just to bring the list of dates in the
correct order (list(cast(datum as varchar))).
I don't know a way to order the result of a list() function except using
a derived table. Otherwise I wouldn't use the derived table.

Uli
Mon, Dec 8 2008 12:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< while this doesn't: >>

I'll get a fix for this in 2.02 B5.  It's an issue with the INSERT..SELECT
parsing criteria being carried on to the derived table.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Dec 8 2008 1:26 PMPermanent Link

Uli Becker
Tim,

> I'll get a fix for this in 2.02 B5.  It's an issue with the INSERT..SELECT
> parsing criteria being carried on to the derived table.

Thanks.

P.S. Is there another way to get an alphabetically ordered list execpt
using a derived table?

Regards Uli
Mon, Dec 8 2008 1:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< P.S. Is there another way to get an alphabetically ordered list execpt
using a derived table? >>

Other than a view instead of a derived table, no.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Dec 8 2008 5:33 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

> Please note that the "order by"-clause does NOT refer to the order of
> the inserted records. It's just to bring the list of dates in the
> correct order (list(cast(datum as varchar))).
Ah, yes.
Sorry, I wasn't "parsing" your statement correctly Smiley

--
Fernando Dias
[Team Elevate]
Tue, Dec 9 2008 2:24 AMPermanent Link

Uli Becker
Fernando,

> Ah, yes.
> Sorry, I wasn't "parsing" your statement correctly Smiley

No problem. Thanks for parsing it at all. Smile

Saludos Uli
Image