Hello,
I have one table [Productionreport_Recepi_Basis Template 2] that builds on a view called [Productionreport_Recepi_Basis Template 1] and it worked perfect until the 1st of november then the basis recepis wheren't updated any longer. I therefor will expand the last date with 365 days. I have tryed this update-query:
UPDATE [Productionreport_Recepi_Basis Template 2] SET [To date] = getdate()+365
WHERE [To date] = (SELECT Max([To Date])
FROM [Productionreport_Recepi_Basis Template 1]
WHERE [To Date] < getdate()
GROUP BY [Product number])
But when I try to execute this syntax I receive this errormessage:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
So can anyone out there tell me if there is an simple way to pass around the problem with more than one value?
I have tryed this also whitout any luck:
UPDATE [Productionreport_Recepi_Basis Template 2] SET [To date] = getdate()+365
WHERE MAX([To Date]) < getdate()
GROUP BY [Product number])
Regards
Gunnien
I have one table [Productionreport_Recepi_Basis Template 2] that builds on a view called [Productionreport_Recepi_Basis Template 1] and it worked perfect until the 1st of november then the basis recepis wheren't updated any longer. I therefor will expand the last date with 365 days. I have tryed this update-query:
UPDATE [Productionreport_Recepi_Basis Template 2] SET [To date] = getdate()+365
WHERE [To date] = (SELECT Max([To Date])
FROM [Productionreport_Recepi_Basis Template 1]
WHERE [To Date] < getdate()
GROUP BY [Product number])
But when I try to execute this syntax I receive this errormessage:
Server: Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
So can anyone out there tell me if there is an simple way to pass around the problem with more than one value?
I have tryed this also whitout any luck:
UPDATE [Productionreport_Recepi_Basis Template 2] SET [To date] = getdate()+365
WHERE MAX([To Date]) < getdate()
GROUP BY [Product number])
Regards
Gunnien