当前位置: 动力学知识库 > 问答 > 编程问答 >

ms access - Analysing multiple rows to determine one status

问题描述:

In one of my tables, some customers have multiple lines - this could be due to re-visits from technicians etc. What I want to do is for each customer ID, analyse whether a re-vist has taken place and place a marker against their name.

I have tried to combine an if/in statement that analyses the max/min visit dates for each customert ID. So if the max>min its classed as a "re-visit", however, i keep getting a syntax error.

Can someone help?

网友答案:

This is a job for two SQL queries:

1st query:

SELECT customerID, count(customerID) as visitCount
FROM tableOfInterest
GROUP BY customerID

2nd query uses first query:

UPDATE customerManifest INNER JOIN queryAbove ON queryAbove.customerID = customerManifest.customerID
SET customerManifest.multipleVisitIndicatorField to queryAbove.visitCount
分享给朋友:
您可能感兴趣的文章:
随机阅读: