Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating percentage via SQL
Message
 
 
À
29/04/2001 20:10:36
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:
00501401
Vues:
15
>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
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform