Table A {id, userId, logTime} Table B {id, userId, dimension mentid, updateTime} Table A is the data record Table B, which is equivalent to the historical record table (dimension mentid of userId before updateTime) currently, table A is associated with Table B, but it can only associate the most recent record that meets the conditions in Table B (also the most recent updateTime before logTime). This is what I do with SELECTA. id, B. userId, B. using mentidfromainnerjoinbona .... mysql
Table A {id, userId, logTime}
Table B {id, userId, dimension mentid, updateTime}
Table A is A data record.
Table B is equivalent to the history table (userId's departmentId before updateTime)
Currently, table A is associated with Table B, but only the most recent record that meets the conditions in Table B can be associated.
(This is also the latest updateTime before logTime)
I did this.
Select a. id, B. userId, B. orders mentid FROM A INNER JOIN B
On a. userId = B. userId and a. logTime> B. updateTime
However, this will retrieve all the data that meets the conditions in Table B, and I only want the most recent one.
Table A and Table B may have multiple userids and dates !!
Solution