Thinkphp Left Join/Right Join 实例

MYSQL上测试语句为:select a.*,b.* from comment a left join reply b on

//Left Join
$Blog->table(‘comment a’)->join(‘reply b on’)->field(‘a.*,b.*’)->order(‘id desc’)->limit(‘8’)->findall();

//Right Join
$Blog->table(‘comment a’)->join(array(‘right’,‘reply b on’))->field(‘a.*,b.*’)->order(‘id desc’)->limit(‘8’)->findall();

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Thinkphp Left Join/Right Join 实例”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>