http://qs321.pair.com?node_id=438495


in reply to reordering a stack with little effort

If you're using Oracle, it's fairly easy:

SELECT ROWNUM, question_id, question FROM questions WHERE SHOW_THE_QUESTION = 1 ORDER BY question_num

If you're using some other database, you can just tick off a counter as you pull them out. You then print and/or refer to the questions by those numbers when you're talking to the user taking the survey. If you're adding/removing questions at a whim, they only really have a 'number' in this sense once the survey/quiz/questionaire/whatever is instantiated, and may change for any other instance. (to build on what Zaxo said)

Update: oops...ROWNUM, not ROW_NUM