mysql - When not to use SQL Cursors and joins -


using mysql, have table

table 1

id  d --------   100   125   50 b   50 b   25 c   5 c   50 c   50 

i need new table: sum id's = id's

table new

id  d  --------   275 b   75 c   105 

how using cursor id's?
how using joins , temp table?

insert table2 (id, d) select id, sum(d) table1 group id   

why use of other methods both inefficient , more complicated write?


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -