Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

sql - How to search for multiple names on different rows where first name and last name on different columns?

ID FIRST_NAME LAST_NAME
1 SARA JAMES
5 STEVE STEPHEN
2 KAL LEE
33 TONY KAMPLOO
3 SANDRA BROWN
23 HOPE WHITE

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This looks like a plain INNER JOIN:

select t1.*
from table1 t1
       inner join table2 t2
         on(t1.first_name = t2.first_name and t1.last_name = t2.last_name)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.7k users

...