bonjour,
j'ai les deux tables suivantes :
Code Java :
et celle laCode:public static final String table_concerne_devis__Name = "concerne_devis"; static final String[] TABLE_concerne_devis = { "n_commande_f int(6) zerofill NOT NULL" , "reference int(4) zerofill NOT NULL" , "prix_unitaire double precision not null", "qte_cf int not null" , "unite varchar(10) not null", "mt_ht double not null " , "taux_tva double precision not null ", "livrer varchar(5) not null ", "constraint wwwaz PRIMARY KEY (n_commande_f,reference)" , "CONSTRAINT sdfdf FOREIGN KEY (n_commande_f) REFERENCES devis (n_commande_f) ", "CONSTRAINT oiopi FOREIGN KEY (reference) REFERENCES article (reference) " };
Code Java :
Code:public static final String[] TABLE_article = { "reference int(4) zerofill AUTO_INCREMENT NOT NULL" , "designation VARCHAR(30) not null" , "marque VARCHAR(30) " , "unite VARCHAR(30) not null " , "t_tva double not null" , "p_a double not null" , "p_v double not null" , "PRIMARY KEY (reference)", "stock_entree int ", "stock_sortie int ", "CONSTRAINT FuuT_PRS FOREIGN KEY (t_tva) REFERENCES taux_tva (tva) " , "CONSTRAINT FqarS FOREIGN KEY (unite) REFERENCES unite_article (unite) " };
le champ livrer de la premiere table prend true ou false
je veux que lorsque on le met a true on diminue stock_sortie de la deuscieme table avec la valeur correspandante de qte_cf de la premiere table
j'ai essayé :
Code Java :
Code:String req1 = "update article set stock_sortie = stock_sortie - (select qte_cf from concerne_devis where n_commande_f ='"+num+"'" + " and reference in (select reference from concerne_devis where n_commande_f ='"+num+"' ) ) where reference in " + "(select reference from concerne_devis where n_commande_f ='"+num+"' )"; System.out.println("req1 : "+req1); st.executeUpdate(req1);
et l'erreur :
avez vous une idéeCode HTML:[CODE][PHP][QUOTE]Subquery returns more than 1 row[/QUOTE][/PHP][/CODE]
-----