Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: reordering a stack with little effort

by sgifford (Prior)
on Mar 11, 2005 at 06:57 UTC ( #438551=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://438551]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-05-29 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?