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
 Help with a diffucilt query

Author  Topic 

danieldiesel12
Starting Member

4 Posts

Posted - 2011-04-11 : 11:34:05
Hi!

I do have a query with a inner and outer table calculating the percentage of used leads in a table.
I would like to add a statement to it.

The query is:
select count(*)*1.0/
(select count (*) from leads where lead_profile1= E.lead_profile1
)*100 AS Bearbetning, lead_profile1 from leads E
where call_status in ('1110','1199','1002', '1003', '22', '16') and substring(lead_profile9,1,3) = 'scr'
group by lead_profile1 order by lead_profile1


That gives me percentage completed. But my new query would estimated how many orders we make if we complete 100%.

I need to devide all orders with the percentaged completed so I know how many orders there will be if we complete 100% or any other given value. Orders have call_status '1110'.

Is there any way I can accomplish this?

Best regards Daniel

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-11 : 12:33:04
Please give us table structure, example data and wanted result.
Otherwise it is not easy to help you.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-04-11 : 14:14:06
I prefer to wait on Peter's mind reading act

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -