Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I need to also add an AND after the where likeWHERE (Id = @CId)and MAX(end) < NOW()
CREATE PROCEDURE dbo.[sp_rsgroup] @Id intASSELECT ISNULL(Group, '') AS GroupCalc, MIN(start) AS START, COUNT(Id) AS CountFROM TableWHERE (Id = @CId)GROUP BY ISNULL(Group, '')ORDER BY startGO
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts
Posted - 2006-08-11 : 20:25:15
CREATE PROCEDURE dbo.[sp_rsgroup] @CId intASSELECT ISNULL(Group, '') AS GroupCalc, MIN(start) AS START, COUNT(Id) AS CountFROM Table WHERE (Id = @CId)and [end] <= getdate()GROUP BY GroupORDER BY startGOIs this what you want?