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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Urgent Query Problem!!!!!

Author  Topic 

prashantdighe
Starting Member

21 Posts

Posted - 2012-05-14 : 01:34:03
Hi all,

I have stuck with some freaking problem....

Following table which i have to deal....

[Session_Type_ID] [Cntribution][Learning] [Intellectual]
1 9 10 0
2 5 7 8
3 4 2 9
4 5 9 5
[Effectiveness] [Program_Name] [Session_Title] [Session_Taken_By]
5 KBC ASP.NET PRASHANT
7 KBC SQL TARUN
6 KBC VB.NET MAYUR
8 XYZ HTML RAJIV
I have to select Contribution, Learning, Intellectual, Effectiveness in such a way so that the rating of below 3 and above 10 will not be counted as well as the average of them counted in group of Session_Taken_By and Session_Title and for same program name

Please help!!!!!!!!

prashantdighe
Starting Member

21 Posts

Posted - 2012-05-14 : 02:08:38
I explain more here to clarify my requirement
The Columns named Contribution,Learning,Intellectual,Effectiveness having rating received from Peoples and I required that rating will be average of that columns group by by session_taken_by and Session_title

please refered following table as I required

Faculty Topics Contribution learning Intellectual Effectiveness

PRASHANT ASP.NET 7.9 7.8 7.8 8.1
TARUN SQL 7.7 7.8 7.9 7.7

MAYUR VB.NET 7.9 7.9 7.9 7.8

RAJIV HTML 7.3 7.2 7.0 7.2
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-05-14 : 12:30:46
show your data as follows

declare @prashant table(Faculty varchar(50), Topics varchar(50), Contribution decimal(10,2), learning decimal(10,2), Intellectual decimal(10,2), Effectiveness decimal(10,2))

insert into @prashant
SELECT 'PRASHANT', 'ASP.NET', 7.9, 7.8, 7.8, 8.1
UNION
SELECT 'TARUN', 'SQL', 7.7, 7.8, 7.9, 7.7
UNION
SELECT 'MAYUR', 'VB.NET', 7.9, 7.9, 7.9, 7.8
UNION
SELECT 'RAJIV', 'HTML', 7.3, 7.2, 7.0, 7.2

select * from @prashant


and then show us result you want. the example you have given does not show any data below 3 and above 10

<><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -