I am trying to run a delete query that contains a subquery and an inner join and get the error
Query must have at least one destination field.
I have read elsewhere that you must use either of the following.
- DISTINCTROW
- WHERE EXISTS
But I still get the error message. I have read How to delete in MS Access when using JOIN's? and MS ACCESS delete query syntax combined with inner join problems but can't get it to work.
Here is my query.
DELETE FROM tblUp
WHERE NOT EXISTS (
SELECT tblUp.request_id,
tblUp.gid,
MAX(tblUp.savings_year) AS MaxOfsavings_year,
LAST(tblUp.savings_month) AS LastOfsavings_month
FROM tblUp
INNER JOIN tbl_w ON tblUp.request_id = tblW.id
GROUP BY tblUp.request_id,
tblUp.gid,
tblW.Cde
HAVING (((tblW.Cde)="ML"))
ORDER BY tblUp.request_id,
tblUp.gid,
MAX(tblUp.savings_year),
LAST(tblUp.savings_month)
)