MYSQL: select latest record only (on left join table)

前端 未结 4 1339
时光说笑
时光说笑 2021-01-17 22:42

I have 2 tables:

Table1:

ID | Mobile Number | Name | Ordered Product| Order Date

Table2:

         


        
4条回答
  •  情书的邮戳
    2021-01-17 23:26

    You can also try this way.

    Select * from table1 a left join
    (Select * from table2 where id in (select max(id) from table2 group by id) ) b on a.id=b.id
    

提交回复
热议问题