[Lugge] Re: query con MYSQL

  • From: asettico <asettico@xxxxxxxxxxxxxxx>
  • To: LUGGe <lugge@xxxxxxxxx>
  • Date: Wed, 01 Sep 2004 11:03:12 +0200

Massimo Arnaudo wrote:

Il mar, 2004-08-31 alle 17:36, asettico ha scritto:

Massimo Arnaudo wrote:

mysql> INSERT INTO gdo.ubicazioni (codice,referente,id_agente_ubi)
SELECT new_tbl.codice,new_tbl.referente,agente.(SELECT agente.id_agente
                                                ^
Non puoi specificare il nome di un campo in questo modo.

FROM agente,new_tbl WHERE (agente.agente = new_tbl.agente)) FROM
agente,new_tbl;

Quale campo della tabella agente vuoi metterci?

vorrei inserire nella tabella ubicazioni i valori di id_agente della tabella agente. Nella tabella originaria (new_tbl) avevo invece il valore fornito dal campo agente, in questo caso alfanumerico.

Ma, allora, non basterebbe questo?

        INSERT INTO gdo.ubicazioni (codice,referente,id_agente_ubi)
        SELECT new_tbl.codice,new_tbl.referente,agente.id_agente
        FROM agente,new_tbl
        WHERE agente.agente = new_tbl.agente;
--
asettico          [ http://www.rossomaltese.it/                        ]
GPG fingerprint   [ BA20 8C8D 7712 9D9A 57F3  A96A A7BE 905C 1CB9 26BA ]

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/IT/O d++(-) s:+>: a34 C++$ ULAVH*++$>++++ P+ L+>++++ E--- W++(-)
N(++) o? K-? w(---) !O M@ V@ PS+@ PE- Y? PGP->++ t+++ 5? X++ R tv+ b+
DI(+) D++(---) G(-)>-- e>++++ h---() r++ y+++*
------END GEEK CODE BLOCK------

========----------

Archivio delle e-mail postate in lista //www.freelists.org/archives/lugge/

Prima di scrivere in m-list per favore leggi il regolamento http://www.lugge.net/index.php?mod=cosa_facciamo/gruppo_di_discussione
Modifica dell'account sulla lista LUGGe http://www.lugge.net/index.php?mod=cosa_facciamo/gruppo_di_discussione#list



Other related posts: