MySQL JOIN the most recent row only?

后端 未结 8 1382
傲寒
傲寒 2020-11-28 03:06

I have a table customer that stores a customer_id, email and reference. There is an additional table customer_data that stores a historical record of the changes made to the

8条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 03:37

    SELECT CONCAT(title,' ',forename,' ',surname) AS name * FROM customer c 
    INNER JOIN customer_data d on c.id=d.customer_id WHERE name LIKE '%Smith%' 
    

    i think you need to change c.customer_id to c.id

    else update table structure

提交回复
热议问题