It's your query that is wrong, it's the final result that should be
ordered, not the subselect, i.e.:

with recursive n (ID_PUJC, NAZEV, PORADI, FK_NADR, uroven)
as (
  SELECT ID_PUJC,    NAZEV,    PORADI,    FK_NADR,    0 FROM def_pujc_test
WHERE fk_nadr is null
  UNION ALL
  SELECT dp.ID_PUJC, dp.NAZEV, dp.PORADI, dp.FK_NADR, n.uroven + 1 FROM
def_pujc_test dp, n WHERE dp.fk_nadr = n.id_pujc
)
SELECT * FROM n
order by poradi

Set

tir. 16. apr. 2019 kl. 02:42 skrev respekt...@post.cz [firebird-support] <
firebird-support@yahoogroups.com>:

>
>
> Hi all,
>
> it is ordered according to order of inserts
>
> I have tried to delete one row and reinsert it - and the row is now last
> :-(
>
> So is there some logical error in my query?
> Or is it the error in fb engine?
>
> Thank you a lot.
> Tom
>
>
> 
  • [firebird-suppo... respekt...@post.cz [firebird-support]
    • [firebird-... respekt...@post.cz [firebird-support]
      • Re: [f... Svein Erling Tysvær setys...@gmail.com [firebird-support]
        • [f... respekt...@post.cz [firebird-support]
        • [f... respekt...@post.cz [firebird-support]
          • ... Richard Damon rich...@damon-family.org [firebird-support]

Reply via email to