Subject Re: Firebird: has ORDER BY in INSERT INTO... FROM being added?
Author Marco Menardi
--- In ib-support@yahoogroups.com, "Alexander V.Nevsky" <ded@h...> wrote:
> --- In ib-support@yahoogroups.com, "Marco Menardi" <mmenaz@l...>
> wrote:
> > Ordering instead of filtering? I can't see how filtering can make
> > sense in the "insert from..." problem I have.
>
> Marco, seems I wrong understood you. I understood - some records
> should be copied, some not because trigger raise exception based on
> some criteria. In this case this criteria should be included into
> Where clause. But you spoke about something like self-referenced
> tree-like hierarhical table, am I right this time?

Perfectly right! I's something like that. I was afraid of telling this
because if you give specific problem, people very often tells you "you
have to change the design", and not help to solve *that* specific
problem. Suggestions about design are very usefull too, but they
should come *in addition* to solution of specific problems, if
available. Or they should in any case consider if that could be a
general problem in another situation. Of course, when I help someone
in newsgroups, I often do the same mistake ;))

> If so, FB1.5 will
> help you. I spoke not clear enough, sorry, in FB1.5 you can use order
> by in _insert from select_ and in _subselect with First 1_. BTW, both
> (trees and First) are not members of standard relational data model,
> so to get advantages of both is needed additional functionality, not
> included into SQL server realizations which were worked out to handle
> standard model of sets and they intersection and joining.

I know my design could be changed to acomodate "standard relational
data model", but the problem is that I choose the deisng because I
know that FB can let me manage my data as well, and then I discover
that there are a lot of places where that does not work. That's really
scaring.

>
> > In addition, you learn that a "select" can have the "order by".
> Having
> > things work or not in different context meas that simple problems
> can
> > become nightmares when you have to solve them in a different context
> > (i.e. a subselect, a where clause, a insert from, etc.).
>
> You forgot peculiarities of usage of Order By in queries with
> aggregates and Group By :) This differences are grown not from
> somebodie's caprice, believe me. If you'll spend some time trying to
> answer yourself - why? - you will reach new level in understanding of
> SQL and sets handling.
>
> Best regards, Alexander.

Thanks
Marco Menardi