mercredi 25 novembre 2015

SQLite Create View to Display Table Columns in Rows

Let's say I have a Table:

CREATE TABLE tbl_TableFullOfStuff (id INTEGER, Name STRING,
    date1 INTEGER, date2 INTEGER);

With Stuff in it:

INSERT INTO tbl_TableFullOfStuff VALUES(1,"thing one", 1448486601, 1448486602);
INSERT INTO tbl_TableFullOfStuff VALUES(2,"thing two", 1448486605, 1448486606);
INSERT INTO tbl_TableFullOfStuff VALUES(3,"thing three", 1448486603, 1448486604);

How can I create a view that makes an independent row for each timestamp?

NAME        |TIMESTAMP
thing one   |1448486601
thing one   |1448486602
thing three |1448486603
thing three |1448486604
thing two   |1448486605
thing two   |1448486606

Aucun commentaire:

Enregistrer un commentaire