Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating percentage via SQL
Message
De
30/04/2001 20:16:54
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00501395
Message ID:
00501836
Vues:
17
>>Is there a away to calculate the percentage via a sql statment for the following
>>i have for example 100 Laptops and these laptops are being sold by several vendors i want to know the percentage of each vendor for example
>>vendor 1 sold 15
>>vendor 2 sold 35
>>vendor 3 sold 50
>>i want to know the percentage of each using the select sql..
>>Thanks to all.
>
>Hi Youssef,
>
>I think, it's doable, but you have to show us the structure of your tables.
>
>If you know, that there were 100 laptops sold,
>you can use this SQL:
>
>
select Vendor, Qty/SumQty*100 as percent from yourtable
>This assumes, that you know the number of all laptops sold (SumQty) and your table has this simple structure
>
>Vendor Qty
>1      15
>2      35
>3      50
Thanks Nadia for you reply and help, but you are assuming that i know the qty well actually i do not know the qty because i have several vendors and i have also multiple items not laptops only i have copiers toners drums and many other things, that is a child table but it is only one table or the data i need is in that table.
The Structure of the table is as follows
Type = and for example laptops copiers and many others
Qtyout = and that is the qty withdrawn from our store
Vendor = Customers that are wholesellers for our laptops and copiers.

i want to know the percentage of each vendor with accordance to the whole qty i sold i will try to give you a close example
I have sold about 250 Laptops
1350 Copier
6800 Toner
of course these items where sold to different vendors, what i want to know is
Vendor 1 sold 50 laptop and 400 Copier and 1400 Toner what is the percent of each item concerning that vendor for every type... Is that Clear
Thanks for Your help, i hope i made my self clear...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform