Select distinct records on a join

前端 未结 4 1601
情深已故
情深已故 2020-12-05 08:18

I have two mysql tables - a sales table:

+----------------+------------------------------+------+-----+---------+-------+
| Field          | Type                    


        
4条回答
  •  萌比男神i
    2020-12-05 08:33

    We can use this:

    INSERT INTO `test_table` (`id`, `name`) SELECT DISTINCT 
        a.`employee_id`,b.`first_name` FROM `employee_leave_details`as a INNER JOIN 
        `employee_register` as b ON a.`employee_id` = b.`employee_id`
    

提交回复
热议问题