Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Incorrect syntax near the word Select in an update statement

$
0
0

Hello,

I am having trouble with this update statement. I am trying to use a select statement in the WHERE clause of the update statement. I am not sure if i am missing something. I am also getting this other error incorrect syntax near the end of file. Can you please tell me what I am doing wrong?

CREATE TRIGGER UpdateStatusLevel
ON Customer
FOR UPDATE
AS
BEGIN
UPDATE Customer
SET StatusLevel = 'Regular'
WHERE CustomerID = SELECT COUNT(o.CustomerID)
				   FROM  [Order] AS o
				   INNER JOIN inserted i
				   on o.CustomerID = i.customerID
				   INNER JOIN Customer c
				   on c.customerID = o.CustomerID
				   WHERE o.CustomerId >= 2;

Thanks,


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>