Do order numbers always increment within customer as
shown in your example, i.e., will a more recent order
for John Doe always have a higher order number than an
earlier order for John Doe? If so, you could say:
UPDATE tblCustomers
SET tblCustomers.[indicator] = "1"
WHERE tblCustomers.ORDER
In (select max(order) from tblCustomers group by Customer);
If you're setting this indicator so that you can retrieve
the most recent order for each customer, then perhaps you
don't really need the indicator at all. The following
will retrieve the most recent order without using any
indicator. (Same idea as the first query, but this time
as a Select query rather than an Update.):
SELECT tblCustomers.*
FROM tblCustomers
WHERE tblCustomers.ORDER
In (select max(order) from tblcustomers group by customer);
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.