Hi Everyone
I'm trying to create a stored procedure that will delete groups that are in-active for a month.
Table description i have two table which are linked together using groupID, when creating the group group info is stored into the group table including the date group was created, and when posting comment to the group, content is stored into the groupPost table.
I have the isDelete column on both table which is a bit data-type - for the group row to be de-actived i need to set is delete column to true.
where is my stored procedure:
[code=mysql]
CREATE PROCEDURE dbo.DeleteInAct iveGroups
AS
UPDATE
dbo.GroupPost
SET
dbo.GroupPost.i sDeleted = 1
WHERE
dbo.GroupPost.G roupID
IN
(
SELECT
*
FROM
dbo.Groups
WHERE
dbo.Groups.Date Created < DATEADD(MONTH, -1, GETDATE())
AND
Groups.UserID <> 37 OR Groups.UserID <> 36
)
[/code]
I keep on getting an error:Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Any help will be appreciated. Thanks in advance
I'm trying to create a stored procedure that will delete groups that are in-active for a month.
Table description i have two table which are linked together using groupID, when creating the group group info is stored into the group table including the date group was created, and when posting comment to the group, content is stored into the groupPost table.
I have the isDelete column on both table which is a bit data-type - for the group row to be de-actived i need to set is delete column to true.
where is my stored procedure:
[code=mysql]
CREATE PROCEDURE dbo.DeleteInAct iveGroups
AS
UPDATE
dbo.GroupPost
SET
dbo.GroupPost.i sDeleted = 1
WHERE
dbo.GroupPost.G roupID
IN
(
SELECT
*
FROM
dbo.Groups
WHERE
dbo.Groups.Date Created < DATEADD(MONTH, -1, GETDATE())
AND
Groups.UserID <> 37 OR Groups.UserID <> 36
)
[/code]
I keep on getting an error:Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Any help will be appreciated. Thanks in advance
Comment