Intégrer un code

jessenierin Messages postés 12 Date d'inscription samedi 15 juillet 2006 Statut Membre Dernière intervention 27 août 2009 - 6 mars 2009 à 07:36
cs_loulou69 Messages postés 672 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 2 juin 2016 - 6 mars 2009 à 07:40
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="ProgId" content="Word.Document" />
<meta name="Generator" content="Microsoft Word 11" />
<meta name="Originator" content="Microsoft Word 11" />
<link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:536871559 0 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
pre
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Tableau Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->

Bonjour




Voici un code developpé par TOFALU je ne sais comment m'y prendre pour le realisé.


Qulq'un a-t-il une idée please??


Merci













Cet
exemple traite plusieurs cas, tous basés sur la table suivante (Commande)
:






 








Ref

,

Quantite

,

Mois

,

----

A1

,
5

,
Juin

,

----

A2

,
10

,
Mai

,

----

A2

,
3

,
Juin

,

----

A4

,
4

,
Aout

,

----

A4

,
4

,
Juin

,

----

A1

,
3

,
Mai

,

----

A1

,
3

,
Mai






Premier
cas










 






On désire
obtenir la somme des produits commandés par mois et par référence ainsi que la
somme total des quantités par produit quelque soit le mois.






 






Le
résultat attendu est donc :






 








Ref

,

Total

,

Aout

,

Juin

,

Mai

,

----

A1

,
11

,
0

,
5

,
6

,

----

A2

,
13

,
0

,
3

,
10

,

----

A4

,
8

,
4

,
4

,
0





Ce
résultat est obtenu par :






 





TRANSFORM Nz(Sum(Commande.quantite),"0") AS SommeDequantite



SELECT Commande.Ref, Nz(Sum(Commande.quantite),"0") AS Total





FROM Commande





GROUP BY Commande.Ref




PIVOT Commande.mois;




Deuxième
cas

1 réponse

cs_loulou69 Messages postés 672 Date d'inscription mercredi 22 janvier 2003 Statut Membre Dernière intervention 2 juin 2016 1
6 mars 2009 à 07:40
Tu veux faire la même chose sans requete SQL?
0
Rejoignez-nous