나는이 두 가지 질문이 하나의 쿼리에서 조인 두 번째 쿼리와 각 이벤트의 조인MySQL의 이벤트를 얻고
제 질문은 어떻게 하나의 쿼리로 모든 작업을 수행 할 수 있습니까? 내가 예를 들어, 다차원 배열을 반환하고 싶습니다
:
가 여기 내 스키마입니다
Array
(
[0] => Array
(
[id] => 1
[title] => Title
[description] => DescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescriptionDescription
[segment] => title
[thumbnail] => 356a192b7913b04c54574d18c28d46e6395428ab.jpeg
[cover] => 356a192b7913b04c54574d18c28d46e6395428ab.jpeg
[locale] => Locale
[address] => Rua Afonso Pena, 22, Tijuca
[list] => 0
[date] => 2013-10-10 10:10:10
[created] =>
[host_id] => 1
[count_joins] => 5
[joined] => 0
[joins] => Array
(
[0] => Array
(
[id] => 4
[first_name] => Giovanna
[last_name] => Carneiro
[email] => [email protected]
[username] => gigi
[thumbnail] => 1b6453892473a467d07372d45eb05abc2031647a.jpg
)
[1] => Array
(
[id] => 5
[first_name] => Júlio
[last_name] => César
[email] => [email protected]
[username] => jujuba
[thumbnail] => ac3478d69a3c81fa62e60f5c3696165a4e5e6ac4.jpg
)
[2] => Array
(
[id] => 3
[first_name] => Claudio
[last_name] => Cardozo
[email] => [email protected]
[username] => cazo
[thumbnail] => 77de68daecd823babbb58edb1c8e14d7106e83bb.jpg
)
[3] => Array
(
[id] => 1
[first_name] => Claudius
[last_name] => Ibn
[email] => [email protected]
[username] => ibnclaudius
[thumbnail] => 356a192b7913b04c54574d18c28d46e6395428ab.jpeg
)
[4] => Array
(
[id] => 2
[first_name] => Elza
[last_name] => Virginia
[email] => [email protected]
[username] => elzavirginia
[thumbnail] => da4b9237bacccdf19c0760cab7aec4a8359010b0.jpg
)
)
)
[1] => Array
(
[id] => 2
[title] => Another Title
[description] => Description
[segment] => another-title
[thumbnail] => da4b9237bacccdf19c0760cab7aec4a8359010b0.jpeg
[cover] => da4b9237bacccdf19c0760cab7aec4a8359010b0.jpeg
[locale] => Locale
[address] => Travessa Nestor Vitor, 117, Tijuca
[list] => 0
[date] => 2013-10-10 10:10:10
[created] =>
[host_id] => 3
[count_joins] => 5
[joined] => 0
[joins] => Array
(
[0] => Array
(
[id] => 1
[first_name] => Claudius
[last_name] => Ibn
[email] => [email protected]
[username] => ibnclaudius
[thumbnail] => 356a192b7913b04c54574d18c28d46e6395428ab.jpeg
)
[1] => Array
(
[id] => 4
[first_name] => Giovanna
[last_name] => Carneiro
[email] => [email protected]
[username] => gigi
[thumbnail] => 1b6453892473a467d07372d45eb05abc2031647a.jpg
)
[2] => Array
(
[id] => 3
[first_name] => Claudio
[last_name] => Cardozo
[email] => [email protected]
[username] => cazo
[thumbnail] => 77de68daecd823babbb58edb1c8e14d7106e83bb.jpg
)
[3] => Array
(
[id] => 5
[first_name] => Júlio
[last_name] => César
[email] => [email protected]
[username] => jujuba
[thumbnail] => ac3478d69a3c81fa62e60f5c3696165a4e5e6ac4.jpg
)
[4] => Array
(
[id] => 2
[first_name] => Elza
[last_name] => Virginia
[email] => [email protected]
[username] => elzavirginia
[thumbnail] => da4b9237bacccdf19c0760cab7aec4a8359010b0.jpg
)
)
)
)
첫 번째 쿼리는 이벤트를 돌아가 두 번째 조인. 가능한 경우 하나만 쿼리하면 모든 것을 반환하고 싶습니다.
많은 정보가 있습니다. 스키마와 일부 데이터를 게시하고 결과를 얻으려는 경우, 더 쉽게 삶을 살 수 있습니다. –
첫 번째 게시물을 편집하여 확인하십시오! –