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 2005 Forums
 Transact-SQL (2005)
 Help in query.

Author  Topic 

ganeshkumar08
Posting Yak Master

187 Posts

Posted - 2008-07-01 : 07:05:54
Hi,
This is my query
Select
THSP.Matchid
,THSP.Playerid
,THSP.Segmentid
,THSP.Speedid
,Sum(THSP.distance) As Distance
,Count(THSP.distance)/2 As time
,Count(distinct THSP.ActivityID) as Act
From TrendHalf_Second_Positions THSP
Inner Join
(
Select
MatchID
,SegmentID
,Time
,TeamInPossession
From TrendHalf_Second_Possession
Where
TeamInPossession <>-1
AND Matchid = 8
And SegmentID In(0,1)
) Poss On Poss.MatchID=THSP.MatchID
And Poss.time=THSP.Time
And Poss.SegmentID=THSP.SegmentID
And Poss.TeamInPossession = THSP.ClubID
Where THSP.matchid =8
And THSP.SegmentID In(0,1) And THSP.Time Between 0 and 60

Group By THSP.Matchid, THSP.Playerid, THSP.Segmentid, THSP.Speedid
Order By THSP.Matchid, THSP.Playerid, THSP.Segmentid, THSP.Speedid

I need to generate this query for each 0 - 60 interval.
So, i need to generate 1 for 0-60 interval, 2 for 60.01 - 120 etc...
How can i get this...

Thanks
Ganesh Kumar

Solutions are easy. Understanding the problem, now, that's the hard part

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-01 : 07:14:33
Upto what limit you want this?
Go to Top of Page

ganeshkumar08
Posting Yak Master

187 Posts

Posted - 2008-07-01 : 07:24:33
And i have two segments i.e, 0 and 1. In segment 0 time starts from 0 - max(time) and in segment1 starts from 0 - max(time)
For ex: 0th segment 0 - 2764 and 1st segment 0-2883
i need continuation, after 0th segments ends with max time, then time time should continue with previous segment time.
for ex: 0-60 = 1 st min, 60.01 - 120= 2 nd min and this end with 2764 with some minute like 46, and again for next segment must continue with 47...

Thanks
Ganesh
Go to Top of Page
   

- Advertisement -