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:
CREATE PROCEDURE dbo.DeleteInActiveGroups
AS
UPDATE
dbo.GroupPost
SET
dbo.GroupPost.isDeleted = 1
WHERE
dbo.GroupPost.GroupID
IN
(
SELECT
*
FROM
dbo.Groups
WHERE
dbo.Groups.DateCreated < DATEADD(MONTH, -1, GETDATE())
AND
Groups.UserID <> 37 OR Groups.UserID <> 36
)
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