Closed iAyubAnsari closed 6 years ago
You only have to add the leftJoin to the select, with the table name and, optionally a condition and mark.
$posts = $db->post->select()
->leftJoin('user', 'user.isVisible = :visible', [':visible' => 1])
->run();
foreach($posts as $post) {
echo $post->user;
}
pardon sir, I cant understand that, how can i execute this :) $query="SELECT * FROM contact_book LEFT JOIN conversations ON contact_book.id=conversations.contact_id ORDER BY conversations.id DESC";
To execute raw queries, you can use $db->execute($query)
, but I suspect this library is not for you.
Thank you sir
how to execute leftJoin function on select query?