bonjour j'ai une table albums et une table users
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 CREATE TABLE IF NOT EXISTS `albums` ( `id` int(11) NOT NULL AUTO_INCREMENT, `artist` varchar(100) NOT NULL, `title` varchar(100) NOT NULL, `id_user` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; INSERT INTO `albums` (`id`, `artist`, `title`, `id_user`) VALUES (100, 'Paolo Nutines', 'tot1', 29), (112, 'Florence + The Machine', 'tot2', 29), (113, 'Massive Attack', 'tot3', 30), (114, 'Andre Rieu', 'tot4', 32), (115, 'Sade', 'tot', 31);
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(25) NOT NULL, `password` varchar(250) NOT NULL, PRIMARY KEY (`id`), KEY `test` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=32 ; -- -- Contenu de la table `users` -- INSERT INTO `users` (`id`, `username`, `password`) VALUES (29, 'ggt', 'cf4251f2392c8ffa5207aa6886574f4b'), (30, 'ggtu', 'cf4251f2392c8ffa5207aa6886574f4b'), (31, 'ggtuio', 'cf4251f2392c8ffa5207aa6886574f4b');
j'aimerai mettre à jour tout les enregistrements 'title' qui existe dans albums dont l'utilisateur existe dans users
alors j'ai suivi ce lien et j'ai fais la requette suivante
sauf que ça ne marche pas :?Code:
1
2
3 update albums set title = 'totosss' from albums inner join users on albums.id_user = users.id
une idée ?
Merci d'avance