SQL SERVEUR EXEMPLE DE REQUETE PIVOT

  • Auteur/autrice de la publication :
  • Post category:SQL
  • Commentaires de la publication :0 commentaire

Exemple : /// select * from ( SELECT P.PINCODE AS TYPEDOC, P.PCVNUM AS NUMDOC, P.PCVDATEEFFET AS DATEDOC, T.TIRCODE AS CODECLIENT, A.ADRSOCIETE AS NOMCLIENT, A.ADRVILLE AS VILLE, P.PCVNUMEXT AS NUMEXT, P.PCVMNTHT , ISNULL(V.CODETAXE,0) AS CODETVA, V.PTVTAUXTVA * 100 AS TAUXTVA, V.PTVBASETVA AS BASETVA, V.PTVMNTTVA AS MTTVA FROM TIERS AS T INNER JOIN PIECEVENTES AS P ON T.TIRID = P.TIRID_FAC INNER JOIN ADRESSES AS A ON P.ADRID_FAC = A.ADRID LEFT OUTER JOIN PIECEVENTETAXES AS V ON P.PCVID = V.PCVID WHERE (P.PINCODE = ‘FACCLI’) ) as temp pivot ( sum(temp.PCVMNTHT) for CODETVA in ([0],[1],[2]) )PIV ///

Laisser un commentaire