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.
| Author |
Topic |
|
prashantdighe
Starting Member
21 Posts |
Posted - 2012-05-14 : 01:54:49
|
| 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 02 5 7 83 4 2 94 5 9 5 [Effectiveness] [Program_Name] [Session_Title] [Session_Taken_By]5 KBC ASP.NET PRASHANT7 KBC SQL TARUN 6 KBC VB.NET MAYUR8 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 namePlease help!!!!!!!! |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-05-14 : 07:49:15
|
quote: Originally posted by prashantdighe 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 02 5 7 83 4 2 94 5 9 5 [Effectiveness] [Program_Name] [Session_Title] [Session_Taken_By]5 KBC ASP.NET PRASHANT7 KBC SQL TARUN 6 KBC VB.NET MAYUR8 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 namePlease help!!!!!!!!
I must admit that I am not following your requirement. If you can post the DDL for the tables, representative sample input data and the corresponding expected output, people on the forum should be able to offer suggestions.Take a look at Brett's blog about how to get the DDL's etc.: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxPerhaps this?SELECT *, AVG(effectiveness*1) OVER (PARTITION BY [Program_Name]) AS AverageFROM YourTableWHERE Effectiveness >= 3 AND Effectiveness <= 10; |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-14 : 23:12:51
|
| are posted data from same table of multiple tables? if from multiple, i cant see any fields by which they're linked.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|