Bonjour,
Je suis sous SQL-Server et j'ai une BDD Commercial qui contient quatre tables, les voici :
On m'a demandé de faire une vue qui réalise ce bon de commande j'ai écris la requête suivante :Citation:
Client (num_cli*,res_cli,tel_cli,adr_cli,ncpt_cli)
Commande(num_cde*,date_cde,delais,date_live,num_cli)
Produit(ref*,desig,pu)
Lignecommande(num_cde*,ref*,qtec)
Mais on essayant de l'afficher le montant de Total commande affiche seulement le montant du premier bon de commande (tous les totaux sont égaux).Code:
1
2
3
4
5
6
7
8
9
10
11
12 use commercial go create view Bondecommande ([Numero de commande],[Designation],[prix unitaire],[Quantite],[Total Ligne],[Total Commande]) as select m.num_cde,p.desig,p.pu,l.Qtec,(p.pu*l.qt (select sum(p.pu*l.qtec) from commande as m join client as c on m.num_cli=c.num_cli join lignecommande as l on m.num_cde=l.num_cde Join produit as p on l.ref=p.ref ) from commande as m join client as c on m.num_cli=c.num_cli join lignecommande as l on m.num_cde=l.num_cde Join produit as p on l.ref=p.ref
J'ai utilisé la clause order by mais rien ne change .
Merci beaucoup.