>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