Hi. I have an SQL code using in VBA Access. There is still some syntax error and cannot see it. I would really appreciate, if anyone has any idea. Thanks. Here is is.
Set rst = Application.CurrentDb.OpenRecordset("SELECT DISTINCT da_MF_DATA_complete.*, com.[comment] As comment FROM da_MF_DATA_complete " _
& " LEFT JOIN (SELECT mf_id, max([date]) As last_date FROM dbo_mf_comment WHERE status_id = 'RLC' AND dbo_mf_comment.origin = 'ACN' GROUP BY dbo_mf_comment.[mf_id]) " _
& " As last_comment ON last_comment.[mf_id] = da_MF_DATA_complete.[mf_id] " _
& " LEFT JOIN dbo_mf_comment As com ON last_comment.[mf_id] = com.[mf_id] AND last_comment.[last_date] = com.[date] " _
& " WHERE current_mf_status_id = 'RLC' AND mf_complete IS NULL ORDER BY return_priority DESC;")