I have a mysql table with columns: customer, dateOrder. One customer can have orders in multiple dates. I want to add a new column with the farthest date order for each customer. So far i tried this:
UPDATE mytable
SET MINDATE = (SELECT min(DATEORDER)
FROM (SELECT *
FROM mytable
GROUP
BY CUSTOMER
) tblTmp
)
, where tblTmp is a temporary table;The problem is that it brings the same date for all my customers (the farthest date in the table). Any ideas?