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:
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