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 2000 Forums
 SQL Server Development (2000)
 Stored Proc

Author  Topic 

seran128
Starting Member

2 Posts

Posted - 2006-08-11 : 19:40:32
I need to also add an AND after the where like




WHERE (Id = @CId)
and MAX(end) < NOW()


CREATE PROCEDURE dbo.[sp_rsgroup]
@Id int
AS

SELECT ISNULL(Group, '') AS GroupCalc, MIN(start) AS START, COUNT(Id) AS Count
FROM Table
WHERE (Id = @CId)
GROUP BY ISNULL(Group, '')
ORDER BY start
GO

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2006-08-11 : 20:25:15
CREATE PROCEDURE dbo.[sp_rsgroup]
@CId int
AS

SELECT ISNULL(Group, '') AS GroupCalc, MIN(start) AS START, COUNT(Id) AS Count
FROM Table
WHERE (Id = @CId)
and [end] <= getdate()
GROUP BY Group
ORDER BY start
GO

Is this what you want?
Go to Top of Page
   

- Advertisement -