我有三个表person_firstname
,person_middlename
,person_lastname
。所有表格都有公共字段entity_id
。我必须在单个记录中选择员工全名。不确定人只有名字,所有名字或仅姓氏。我试过联合它返回三行。
还需要通过entity_id记录特定员工。所以需要匹配像entity_id = 123这样的记录。其entity_id为123的员工的所有姓名。
答案 0 :(得分:0)
SELECT p1.first_name person_firstname,p2.middle_name person_middlename,p3.last_name person_lastname FROM person_firstname p1 JOIN person_middlename p2 ON p1.entity_id = p2.entity_id JOIN person_lastname p3 ON p3.entity_id = p2.entity_id;
答案 1 :(得分:0)
a b c d
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0
0 0 0 0