Ajouter 1€ a toutes les lignes

Par Pierrot01, il y a 8 ans


Base de données MySQL

Bonjour,

Voila je rencontre un petit problème avec mon code.

Ce que je fais

Décrivez ici votre code ou ce que vous cherchez à faire

use prostand_profil; update analytique_technique_lignes set previsionnel_achat = previsionnel_achat+1;

Ce que je veux

je veux ajouter 1€ sur le previsionnel_achat

Ce que j'obtiens

Voilà l'erreur que me retourne MSQL !!!
Error Code: 1242. Subquery returns more than 1 row

4 réponses

Pierrot01, il y a 8 ans

Salut,
mon id est une clef primaire en auto incrément.
si elle est multplpe, y a un bug !!

@plus

Pierre

krysenn, il y a 8 ans

Salut,

L'exemple de stackoverflow n'était pas à prendre sans modification.

As-tu un schéma de ta base ? Donne nous quelques lignes afin de mieux comprendre

Pierrot01, il y a 8 ans

Salut,

CREATE TABLE prostand_profil.analytique_technique_lignes ( id INT(11) NOT NULL AUTO_INCREMENT, id_analytique_technique INT(11) NOT NULL DEFAULT 0, id_poste INT(11) NOT NULL, lib_art VARCHAR(100) DEFAULT NULL, reutilisation TINYINT(1) NOT NULL DEFAULT 0, service TINYINT(1) NOT NULL DEFAULT 0, pa_estime DECIMAL(10, 2) NOT NULL DEFAULT 0.00, str_fournisseur VARCHAR(50) DEFAULT NULL, id_commande INT(11) DEFAULT NULL, prix_ht_commande DECIMAL(10, 2) DEFAULT 0.00, previsionnel_achat DECIMAL(10, 2) NOT NULL, pourcentage_poste DECIMAL(10, 0) DEFAULT NULL, commentaire VARCHAR(255) DEFAULT NULL, id_article INT(11) NOT NULL DEFAULT 0, updatable TINYINT(4) NOT NULL DEFAULT 0, PRIMARY KEY (id), INDEX IDX_analytique_technique_ligne (id_analytique_technique, id_poste) ) ENGINE = INNODB AUTO_INCREMENT = 50977 AVG_ROW_LENGTH = 94 CHARACTER SET utf8 COLLATE utf8_general_ci ROW_FORMAT = DYNAMIC;

Pour le code, tu l'as en totalité, c'est une requête que je veux envoyé dans l'éditeur de MYSQL Workbench.

@plus

Pierre