try this on northwind :

declare @total as decimal
set @total=(select count(*) from products) 
select  categoryname,count(*)as total,
temp=cast(cast(round(( count(*)/@total*100 ),2) as decimal(5,2)) as char(8)) + 
'%'
from products,categories
where categories.categoryid=products.categoryid
group by categoryname
order by total
----- Original Message ----- 
From: "Boy band" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 06, 2005 8:16 AM
Subject: [vbhelp] Need Help On counting percent (%)


> 
> 
> Dear Friends, I need Help, I was making some programs
> using VB but I have dificulties when I want to count
> the percentage (%) of the Item. I was using Access for
> my database.
> Ex :
> No.    Item
> 1.       A
> 2.       B
> 3.       C
> 4.       A
> 5.       B
> with that kind of data that I`ll have save to the
> database,and I want to look for A = ....% ; B=.....%;
> C=.....%.
> 
> Beside that Problem I have some other problem with
> data grid. When I save new data to the database, the
> datagrid didn`t show the new data on screen? is there
> some way that when I`m inserting the new data then the
> datagrid refresh automatically.(I connect the datagrid
> using code)
> I hope u will get what I meant guys!!! thank alot
> 
> 
> 
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Personals - Better first dates. More second dates. 
> http://personals.yahoo.com
> 
> 
> 
> 
> 
> 
> 
> '// =======================================================
>     Rules : http://ReliableAnswers.com/List/Rules.asp
>     Home  : http://groups.yahoo.com/group/vbHelp/
>     =======================================================
>     Post  : [email protected]
>     Join  : [EMAIL PROTECTED]
>     Leave : [EMAIL PROTECTED]
> '// =======================================================
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 

[Non-text portions of this message have been removed]




'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to