Bonjour les développeurs;
je suis actuellement en cours de développer une requête sql pour avoir un out put pourcentage. mes tables sont:
fait-vente:
menage id-produit pénétration
1 2 OUI
2 2 OUI
3 1 OUI
4 1 OUI
. . .
. . .

le table produit:
id-produit id-sous-categorie nom-sous-categorie id-categorie nom-categorie
1 1 8 portions 1 la vache qui rit
2 2 16 portions 1 la vache qui rit
3 1 8 portions 2 RIKI
3 2 16 portions 2 RIKI
4 1 8 portions 3 FROMY
5 2 16 portions 3 FROMY


alors j'ai besoin de calculer le part de marché en terme de valeur de chaque categorie de produit (prix de sous categorie de produit*nbre de menage quit sont achetés) ma requête est comme suite :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
select (0.200 * COUNT(`id-menage`)) AS `Somme Dépensé `, p.`nom-sous-categorie`, p.`nom-categorie` 
from `fait-achat` f ,`produit` p
where  p.`id-sous-categorie` =1 and   p.`id-categorie`=1 and f.`id-produit`=p.`id-produit` and f.`penetration`="OUI"
 group by p.`code-sou-cat`
 
UNION
 
select (1.620 * COUNT(`id-menage`)) AS `Somme Dépensé `, p.`nom-sous-categorie` , p.`nom-categorie` 
from `fait-achat` f ,`produit` p
where  p.`id-sous-categorie` =2 and  p.`id-categorie`=1 and  f.`id-produit`=p.`id-produit`and f.`penetration`="OUI"
 group by p.`code-sou-cat`
 
union
select (220 * COUNT(`id-menage`)) AS `Somme Dépensé `, p.`nom-sous-categorie` , p.`nom-categorie` 
from `fait-achat` f ,`produit` p
where  p.`id-sous-categorie` =1 and  p.`id-categorie`=2 and  f.`id-produit`=p.`id-produit` and f.`penetration`="OUI"
 group by p.`code-sou-cat`
 
UNION
select (2.420 * COUNT(`id-menage`)) AS `Somme Dépensé `, p.`nom-sous-categorie` , p.`nom-categorie` 
from `fait-achat` f ,`produit` p
where  p.`id-sous-categorie` =2 and  p.`id-categorie`=2 and  f.`id-produit`=p.`id-produit` and f.`penetration`="OUI"
 group by p.`code-sou-cat`
.......

le résultat m'affiche comme valeur alors que je l'aime afficher en % càd:

Au lieu de :

somme-depensé categorie-produit sous-categorie-produit
200.000 RIKI 8 portions
200.000 RIKI 16 portions
120.000 FROMY 8 portions
180.000 FROMY 16 portions
90.000 LA VACHE QUI RIT 8 portions
210.000 LA VACHE QUI RIT 16 portions


je veux

somme-depense-pourcentage categorie-produit
40% RIKI
30% FROMY
30% LA VACHE QUI RIT

veuillez vous m'aider SVP