INSERT SELECT

Sintassi

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
    [INTO] nome_tabella [(nome_colonna, ...)]
    SELECT ...
    [ ON DUPLICATE KEY UPDATE nome_colonna=espr, ... ]

Spiegazione

Con INSERT ... SELECT, è possibile inserire molte riga in una tabella, prelevandole da un'altra o da più tabelle. Esempio:

INSERT INTO tabella_temp2 (campo_id)
  SELECT tabella_temp1.campo_id_ordine
  FROM tabella_temp1 WHERE tabella_temp1.campo_id_ordine > 100;

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.