MySQL Forums
Forum List  »  French

Re: requete insert avec condition
Posted by: Huu Da Tran
Date: March 02, 2008 10:49AM

Avec ceci, tu devrais pouvoir te débrouiller (vu que je ne sais pas ce que ça veut dire «si le select est bon»...):
insert into `commande` (`article`, `quantite`)
    select distinct '$nomarticle', $quantitecommande
        from `produit`
        where `article` like '$nomarticle';
En résumé, tu fais un insert seulement si ton select te retourne quelque chose. Le distinct est présent pour t'assurer que si plusieurs `produits`.`article` like '$nomarticle' sont retournés.

Bonne chance,

H.

Options: ReplyQuote


Subject
Views
Written By
Posted
12509
February 26, 2008 06:48AM
5450
February 26, 2008 03:39PM
6320
February 29, 2008 03:07AM
Re: requete insert avec condition
5343
March 02, 2008 10:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.