Re: [sqlite] Changing order - why??
Hi folks, might it be possible, that someone explains, why anyone would put effort in this task? Aren't databases designed to keep data in whatever order... :-? Greetings, Ralph Hello I have little problem with changing order of rows. I have a simple table articles: CREATE TABLE articles ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title VARCHAR, content VARCHAR, order INTEGER UNIQUE, ); when inserting row order is a copy of id (trigger used). I have few rows 1, test1, test1, 1 2, test2, test2, 2 3, test3, test3, 3 Now i want to "move down" row with id 2, to table looks like this: 1, test1, test1, 1 2, test2, test2, 3 3, test3, test3, 2 Any suggestions ? Maybe there is better way to moving rows ? Regards, Bambero - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Changing order
On 11/12/06, Gerry Snyder <[EMAIL PROTECTED]> wrote: Bambero wrote: > Hello > > I have little problem with changing order of rows. I have a simple > table articles: > > CREATE TABLE articles ( > id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, > title VARCHAR, > content VARCHAR, > order INTEGER UNIQUE, > ); > when inserting row order is a copy of id (trigger used). > I have few rows > > 1, test1, test1, 1 > 2, test2, test2, 2 > 3, test3, test3, 3 > > Now i want to "move down" row with id 2, to table looks like this: > > 1, test1, test1, 1 > 2, test2, test2, 3 > 3, test3, test3, 2 > > Any suggestions ? Maybe there is better way to moving rows ? > First of all, is that what you really want? Just the last column moved? Or do you want: 1, test1, test1, 1 2, test3, test3, 3 3, test2, test2, 2 This seems to be what your words are describing. And, if so, would: 1, test1, test1, 1 3, test3, test3, 3 4, test2, test2, 2 be okay? That would seem simpler to implement. I'm retrieving rows "order by" order (last column). But I don't know how to implement "move up/move down" functionality. The best for me will be changing order -1 +1, but this is unique column. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Changing order
Bambero wrote: Hello I have little problem with changing order of rows. I have a simple table articles: CREATE TABLE articles ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title VARCHAR, content VARCHAR, order INTEGER UNIQUE, ); when inserting row order is a copy of id (trigger used). I have few rows 1, test1, test1, 1 2, test2, test2, 2 3, test3, test3, 3 Now i want to "move down" row with id 2, to table looks like this: 1, test1, test1, 1 2, test2, test2, 3 3, test3, test3, 2 Any suggestions ? Maybe there is better way to moving rows ? First of all, is that what you really want? Just the last column moved? Or do you want: 1, test1, test1, 1 2, test3, test3, 3 3, test2, test2, 2 This seems to be what your words are describing. And, if so, would: 1, test1, test1, 1 3, test3, test3, 3 4, test2, test2, 2 be okay? That would seem simpler to implement. HTH, Gerry - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Changing order
Hello I have little problem with changing order of rows. I have a simple table articles: CREATE TABLE articles ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title VARCHAR, content VARCHAR, order INTEGER UNIQUE, ); when inserting row order is a copy of id (trigger used). I have few rows 1, test1, test1, 1 2, test2, test2, 2 3, test3, test3, 3 Now i want to "move down" row with id 2, to table looks like this: 1, test1, test1, 1 2, test2, test2, 3 3, test3, test3, 2 Any suggestions ? Maybe there is better way to moving rows ? Regards, Bambero - To unsubscribe, send email to [EMAIL PROTECTED] -