Heidestrand
Registered User.
- Local time
- Today, 15:47
- Joined
- Apr 21, 2015
- Messages
- 73
Hello,
I want to update a column by checking a condition if an order number already exists in the past. I coded some SQL but it doesn't work how I want
a.sapsys_SAPNr is my column with order numbers. So the query should check if an order number in this column already exists in the past by the help of the date in column sapsys_date. If yes, then it should copy the values from column Kalendertag into sapsys_date.
When I execute the query, nothing happens. But I don't know what's wrong with it.
I appreciate any help from you!
I want to update a column by checking a condition if an order number already exists in the past. I coded some SQL but it doesn't work how I want

Code:
UPDATE tblSAPSys AS a INNER JOIN tblDatenAusExcelNeu AS b ON a.sapsys_SAPNr = b.Verkaufsbeleg SET a.sapsys_date = b.Kalendertag
WHERE EXISTS
(SELECT *
FROM tblSAPSys As c
WHERE c.sapsys_SAPNr = a.sapsys_SAPNr AND c.sapsys_date < a.sapsys_date);
When I execute the query, nothing happens. But I don't know what's wrong with it.
I appreciate any help from you!