0
우선 제목이 관련이 있는지 여부를 알지 못합니다 (관련성이 없다면 저를 용서해주십시오).ID를 사용하여 연결 테이블에서 값을 가져 오는 방법은 무엇입니까?
2 테이블 userprofile
및 country
이 있습니다.
userprofile table:-
-----------------------------------------
userid | email |............|**countryid**
-----------------------------------------
country table:-
-----------------------------------------
**countryid** | countryname
-----------------------------------------
, 즉 $query="select * from userprofile
...하지만 문제는이 데이터 반환 countryid하지만 실제로 COUNTRYNAME을 반환 할 것입니다.
저는 MySQL을 처음 사용 했으므로이를 달성하는 가장 좋은 방법을 제안하십시오.
팁 :
이 유사한 결과 세트를 생성합니다 이름의 경우 'SELECT * FROM userprofile LEFT JOIN country USING countryid' – Savageman
정상적인 조인 (what is wrong)에 SELECT가 틀린 지 SELECT * FROM userprofile, country WHERE userprofile. countryid = country.countryid – Waygood
@Waygood : [SQL 결합에 대한 시각적 설명] (http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html). – eggyal