Hi,
I am new to SQL server but have had a bit of exposure to MS Access.
I am trying to run a simple update query on single table (dbo.tblClient). I ran the code as a SELECT script and it produces the correct results, but when I change this to an UPDATE i get a message informing me that the 'subquery returned more than 1 value....'.
Therefore my question is - How do I update multiple records within the table using an UPDATE query?
The code I am using is this -
UPDATE dbo.tblClient
SET ClientCategoryID = 23
WHERE EnquiryNotes like '%Category=UK%'
AND ClientCategoryID = 0
AND EntryDate >= DATEADD(day,-7, GETDATE())
and the successful SELECT query is this -
SELECT ClientID, ClientCategoryID, EntryDate
FROM dbo.tblClient
WHERE EnquiryNotes like '%Category=UK Removals%'
AND ClientCategoryID = 0
AND EntryDate >= DATEADD(day,-7, GETDATE())
Many Thanks
Alan
I am new to SQL server but have had a bit of exposure to MS Access.
I am trying to run a simple update query on single table (dbo.tblClient). I ran the code as a SELECT script and it produces the correct results, but when I change this to an UPDATE i get a message informing me that the 'subquery returned more than 1 value....'.
Therefore my question is - How do I update multiple records within the table using an UPDATE query?
The code I am using is this -
UPDATE dbo.tblClient
SET ClientCategoryID = 23
WHERE EnquiryNotes like '%Category=UK%'
AND ClientCategoryID = 0
AND EntryDate >= DATEADD(day,-7, GETDATE())
and the successful SELECT query is this -
SELECT ClientID, ClientCategoryID, EntryDate
FROM dbo.tblClient
WHERE EnquiryNotes like '%Category=UK Removals%'
AND ClientCategoryID = 0
AND EntryDate >= DATEADD(day,-7, GETDATE())
Many Thanks
Alan