2021年5月4日星期二

Mysql, select from table multiple values

I have two tables in my database.

Couples table:

+---------------------------------------+  |  ID | Partner 1 | Partner 2           |  +---------------------------------------+  |  1   | 101       | 102                |  +---------------------------------------+  

B table:

+--------------------------------------------------------------  | ID | name                 | date      | Letter | Phonenumber  +--------------------------------------------------------------  | 101| Mark                 | 1/1/2001  | D      | 061234  | 102| lisa                 | 1/1/2002  | E      | 061235  

I cant quite figure out how to do the following:

Select from couples table the partners 1 & 2. From partner 1, grab the name, date, letter & phonenumber. From partner 2, grab the name, letter and date. Do this for every couple in the couples table

I cant figure out how to do this, anyone know how? I have been stuck for quite some time now haha. something like this

+------------------------------------------------------------------------  | ID | name | date      | Letter | Phonenumber | name | Letter| date  +------------------------------------------------------------------------  | 1  | Mark | 1/1/2001  | D      | 061234      | lisa | E     | 1/1/2002   +------------------------------------------------------------------------  
https://stackoverflow.com/questions/67393892/mysql-select-from-table-multiple-values May 05, 2021 at 08:54AM

没有评论:

发表评论