Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating percentage via SQL
Message
 
 
To
29/04/2001 20:10:36
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00501395
Message ID:
00501401
Views:
18
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform