You are not logged in.
Pages: 1
Topic closed
Bonjour,
Je souhaiterai faire une copie des valeurs de nom/prénom utilisateur vers les contacts.
En premier lieu:
J'ai créé une nouvelle table car j'ai vu que dans la table glpi_users il y avait également un attribut "name" comme dans glpi_computers.
mysql> create table anna_tab_id_user AS
⇒ select ID,name from glpi_users;
mysql> alter table anna_tab_id_user change ID ID_user int(11);
Query OK, 626 rows affected (0.41 sec)
Records: 626 Duplicates: 0 Warnings: 0
mysql> alter table anna_tab_id_user change name name_user varchar(255);
Query OK, 626 rows affected (0.00 sec)
Records: 626 Duplicates: 0 Warnings: 0
Ensuite j'ai voulu faire la copie massive, qui n'a pas marché:
UPDATE glpi_computers
SET glpi_computers.contact = anna_tab_id_user.name_user
FROM glpi_computers
INNER JOIN anna_tab_id_user ON glpi_computers.FK_users =anna_tab_id_user.ID_user;
J'ai cette erreur:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM glpi_computers INNER JOIN anna_tab_id_user ON glpi_computers.FK_users = ann' at line 1
J'ai également tenté cette syntaxe:
update glpi_computers
set glpi_computers.contact=anna_tab_id_user.name_user
from glpi_computers,anna_tab_id_user
where glpi_computers.FK_users=anna_tab_id_user.ID_user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from glpi_computers,anna_tab_id_user where glpi_computers.FK_users=anna_tab_id_u' at line 1
Je ne sais plus quoi faire.
Merci
Offline
J'ai trouvé!!
mysql> UPDATE glpi_computers INNER JOIN anna_tab_id_user ON glpi_computers.FK_users = anna_tab_id_user.ID_user SET glpi_computers.contact = anna_tab_id_user.name_user;
Query OK, 325 rows affected (0.09 sec)
Rows matched: 325 Changed: 325 Warnings: 0
on peut clôturer^^
Offline
Pages: 1
Topic closed