2
나는 수 일간 stackoverflow를 거치면서 많은 검색을했으나 여전히 해결책을 찾을 수 있습니다. 나는 2 개 테이블이 프로필이 테이블 프로파일 지금하나의 테이블에있는 여러 행이 여러 행을 표시하지 않고 다른 테이블의 행 하나와 관련이있는 mysql의 값 연결
pro_id surname firstname
-------- -------- ------------
1 John James
2 King Fred
3 Paul Smith
4 Cindy Hayes
Qua_id Degree School Year
------ ------ ------ -----
1 MBA Wharton university 2002
1 LLB Yale University 2001
2 BSc Covington University 1998
2 BEd Kellog University 1995
2 Msc MIT 2011
3 MBA Havard Business School 2002
3 MSc Yale University 2012
4 BSc University of Edinburgh 2010
4 BA University of Liverpool 2009
의 자격 내가 달성하고자하는 것은이
1 John James MBA Wharton university 2002, LLB Yale University 2001
2 King Fred BSc Covington University 1998, BEd Kellog University 1995, Msc MIT 2011
3 Paul Smith MBA Havard Business School 2002, MSc Yale University 2012
4 Cindy Hayes BSc University of Edinburgh 2010, BA University of Liverpool 2009
이다하지만 내가 현재있는 것은 다음과 같습니다
1 John James MBA Wharton university 2002
1 John James LLB Yale University 2001
2 King Fred BSc Covington University 1998 BEd
2 King Fred Kellog University 1995
2 King Fred Msc MIT 2011
3 Paul Smith MBA Havard Business School 2002
3 Paul Smith MSc Yale University 2012
4 Cindy Hayes BSc University of Edinburgh 2010
4 Cindy Hayes BA University of Liverpool 2009
내 코드는
Select pro_id, surname, firstname concat(degree,school,year) as qual from profile,qualification Where profile.proid=qualification.qua_id
(난 정말 USER_ID 수 shoudl 생각하는 - 즉, 그들이해야 사용자 테이블에 둘 수있는 사용자 ID와 외래 키) qua_id 아마도 PROFILE_ID한다 -
'GROUP_CONCAT (CONCAT (학위, 학교, 연도))' –
고마워요. 그것은 효과가있다! 필드 이름에 대한 귀하의 의견은 –
으로 표시됩니다. 세 번째 테이블을 추가하고 값을 연결하려고한다면 어떻게해야합니까? –