Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Percentage in SQL

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-06-10 : 06:20:34
Dear All,

I have this query
Select Project,isnull(sum(total_seats),0) as TS,isnull(sum(Single_Seats),0) as SS,sum(Single_Seats) /sum(total_seats) from MSTR_GARDEN_SEATS where status='active'
and Single_Seats <> '0'
group by Project

I wanted to show the percentage through sql for third column.Please help

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-10 : 06:25:55
Is this?

Select Project,isnull(sum(total_seats),0) as TS,isnull(sum(Single_Seats),0) as SS,sum(Single_Seats*1.0) /sum(total_seats)*100 from MSTR_GARDEN_SEATS where status='active'
and Single_Seats <> '0'
group by Project

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -