INSERT INTO destination ( col1 , col2 )
SELECT col3, col4 FROM source
And what if you wish to collapse a subquery in your query results? More complex, but can be easily done with GROUP_CONCAT:
SELECT stuff.., GROUP_CONCAT( column_to_sum_up ) AS newname
FROM main_source
LEFT JOIN other_table_containing_things_to_collapse ON condition
LEFT JOIN other_table_containing_things_to_collapse ON condition
GROUP BY column_in_main_source_that_explains_collapse
2 comments:
peccato funzioni solo in mysql, a quanto pare...
bel trucchetto, comunque!
giusto. l'ho specificato nelle tags ma il titolo รจ fuorviante :)
correggo, grazie della segnalazione
Post a Comment