当电子邮件中包含员工姓名时,我想显示姓名和与之关联的电子邮件。一个用户可以拥有多个电子邮件。
employee
id name
1 Steve Been
2 Rob Kem
3 Bob Kimi
Emails
emplyee_id email
1 steve@domain.com
1 007@domain.com
1 Been@domain.com
2 Robkem@domain.com
2 Rob.Kem@domain.com
3 Boooob@domain.com
3 kimi@domain.com
查询不应区分大小写。我希望这个查询向我展示如下内容:
name email
Steve Been steve@domain.com
Steve Been Been@domain.com
Rob Kem Robkem@domain.com
Rob Kem Rob.Kem@domain.com
Bob Kimi kimi@domain.com
我试过了,但我得到了空输出:
select empl.Name as 'employee Name', em.email as 'Product Name'
from email em JOIN employee empl
ON em.employee_id = empl.ID
WHERE FIND_IN_SET(LOWER(empl.Name),LOWER(em.Name))