简体   繁体   中英

SQL one row equals to two merged rows

Hi I'm doing project in Java and i have two tables in SQL and i want to link data between them.

Here is my problem, the first table have 2 columns named name and surname , and the second table have a row namesurname (there are other columns in each table) where name and surname are connected.
Table 1 :

name -   Example         

surname  -  Something 


Table 2:

namesurname - Example Something


How can i make a link between these two tables to display all data from Table 2 . based on inserted name and surname in Table 1 .

Have you tried something like

select * from 1.table join 2.table on [2.table].namesurname = [1.table].name+" "+[1.table].surname

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM