Last active
August 29, 2015 14:01
-
-
Save Ronmi/385c9c37feccf913cd77 to your computer and use it in GitHub Desktop.
某 SQL Builder 將使用的 FROM 建立語法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// (`model1` LEFT JOIN `model2` ON `model2`.`col2`=`model1`.`id`) | |
$from = $b->tables( | |
$b->left_join($m1, $m2, $b->eq($m2->col2, $m1->id)) | |
); | |
// `model1`,`model2`,`model3` | |
$from = $b->tables($m1, $m2, $m3); | |
//((`model2` LEFT JOIN `model3` ON `model2`.`col2`=`model3`.`id`) LEFT JOIN `model1` ON `model2`.`col2`=`model1`.`id`) | |
$from = $b->tables( | |
$b->left_join( | |
$b->left_join($m2, $m3, $b->eq($m2->col2, $m3->id)), | |
$m1, | |
$b->eq($m2->col2, $m1->id) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment