Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/lib/risorse.common.lib.php on line 280
AWB Informatica - Inserire dati da una SELECT in una tabella MariaDB-MySQL

Inserire dati da una SELECT in una tabella MariaDB-MySQL

12 April 2016

​Se vogliamo effettuare l'inserimento di un record in una tabella MariaDB-MySQL ricavando i valori da una seconda tabella (eventualmente la medesima), possiamo combinare le istruzioni SQL INSERT e SELECT
La sintassi da usare sarà:
MariaDB> INSERT INTO tabellaA (colonne) SELECT colonne FROM tabellaB;
Supponendo di avere una tabella foto e di voler creare un nuovo record a partire da un'altro record già presente, possiamo utilizzare il seguente comando:
MariaDB>INSERT INTO foto (FotoNome, FotoDescr, FotoFileId, FotoVisibile) SELECT FotoNome, FotoDescr, FotoFileId, FotoVisibile FROM foto where FotoId=172; 

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556

Deprecated: Function strftime() is deprecated in /home/hosting/awbinformatica_it/www/php/template/page_template.php on line 556