0
MySql 쿼리의 두 테이블에서 "title"을 삽입하려고합니다. 아래의 첫 번째 쿼리를 실행하면 작동합니다. 두 번째 글자를 추가하면 '블로그'제목은 계속되지만 두 번째 '앨범'제목은 가져 오지 않습니다. 두 테이블에서 두 제목을 모두 얻는 방법에 대한 아이디어가 있습니까?하나의 MySQL 쿼리에 LEFT JOIN이 두 개임
$query = "SELECT updates.*, albums.title FROM updates ";
$query .= "LEFT JOIN albums ON updates.ref_table = 'albums' AND updates.ref_id = albums.id ";
$query .= "WHERE user_id = ".$user_id." ORDER BY date DESC";
Doen't 작업 ...
$query = "SELECT updates.*, albums.title, blog.title FROM updates ";
$query .= "LEFT JOIN blog ON updates.ref_table = 'blog' AND updates.ref_id = blog.id ";
$query .= "LEFT JOIN albums ON updates.ref_table = 'albums' AND updates.ref_id = albums.id ";
$query .= "WHERE user_id = ".$user_id." ORDER BY date DESC";
도움을 주셔서 감사합니다. :) – Chris