Unless I'm reading you wrong then just do the normal

begin transaction;
update playYouTubeVideo set speed = (
    select speed from playYouTubeVideo where key = '2')
    where key = '1';
update playYouTubeVideo set speed = (
    select speed from playYouTubeVideo where key = '3')
    where key = '2';
...
update playYouTubeVideo set speed = (
    select speed from playYouTubeVideo where key = '5')
    where key = '1';
commit;


-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Cecil Westerhof
Sent: Monday, January 22, 2018 3:30 PM
To: SQLite mailing list
Subject: [sqlite] Can this be done with SQLite

I have the following table:
CREATE TABLE playYouTubeVideo (
    key     TEXT    NOT NULL,
    speed   FLOAT   NOT NULL,

    CONSTRAINT key   CHECK(length(key)  == 1),
    CONSTRAINT speed CHECK(TYPEOF(speed) = "real"),

    PRIMARY KEY(key)
);


Say I want to rotate a part:
- The value by key '1' becomes the value by key '2'.
​- The value by key '2' becomes the value by key '3'.
​- The value by key '3' becomes the value by key '4'.
- The value by key '4' becomes the value by key '5'.
- The value by key '5' becomes the value by key '6'.

​I suppose that I need to do this programmatically, or can this be done
with SQL?

And optionally also:
​- The value by key '1' becomes the value by key '5'.
​
-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to