in reply to Re: reordering a stack with little effort
in thread reordering a stack with little effort

Cool idea, but I can't think of how you would ask SQL to put the list in order for you...
  • Comment on Re^2: reordering a stack with little effort

Replies are listed 'Best First'.
Re^3: reordering a stack with little effort
by Crackers2 (Parson) on Mar 11, 2005 at 19:21 UTC

    In Oracle you can use CONNECT BY to do this:

    SELECT id FROM thetable START WITH id = 1 CONNECT BY PRIOR next = id
Re^3: reordering a stack with little effort
by punkish (Priest) on Mar 11, 2005 at 14:17 UTC
    this is actually a very nice idea... you would simply ORDER BY NEXT instead of ORDER BY QUESTION_NUM. To tell the truth, I thought of using this method, but chose to implement the decimal system instead. I still think this is better, but since my decimal system is already working, I am gonna leave it in place. For my next implementation, I am going to use a linked list.
    --

    when small people start casting long shadows, it is time to go to bed
      you would simply ORDER BY NEXT instead of ORDER BY QUESTION_NUM

      Sadly, no -- once you start rearranging the questions, the values in the "next" column need not be in ascending numerical order... I think you'll need to sort them in Perl rather than at the SQL DBMS.