sql如下:
SELECT t.*,d.name as "workName" FROM t_traceability_slice t LEFT JOIN sys_department d ON t.workshop_code = d.code WHERE t.del_flag = '0' AND t.enterprise_id = 81 AND ( t.production_Batch LIKE '%B463463543525%' OR t.import_Batch LIKE '%B463463543525%' )
原因分析:由于sys_department表id字段没有设置为主键,不管是内连接,左连接还是右连接,只要查询sys_department表,就会查出两条记录。