mysql - How to write a SQL patch that will take values from table A and insert as row within table B? -
i need take every row within photoprocesstable has storyid value (not 0 or null) , insert entry new table called photoprocessstory.
example of row within photoprocess table :
+----------------+----------+----------+ | processid | storyid | rating | +----------------+----------+----------+ | 111111111 | 322 | 1 | | 111111112 | 333 | 1 | | 111111113 | 0 | 1 | +----------------+----------+----------+ the end resulting photoprocessstory table this:
+-----+----------------+-------------------+ | id | processid | storyid | +-----|----------------+-------------------+ | 1 | 111111111 | 322 | | 2 | 111111112 | 333 | +-----+----------------+-------------------+ any appreciated. have experience joining tables , inserting values columns, not familiar on how insert rows within patch this.
insert photoprocessstory (processid, storyid) select processid, storyid photoprocess storyid <> 0 , storyid not null
Comments
Post a Comment