- 原生查询:
$Model = new Model();
$sql = ‘select a.id,a.title,b.content from think_test1 as a, think_test2
as b where a.id=b.id ‘.$map.‘ order by a.id ‘.$sort.‘ limit
‘.$p->firstRow.‘,‘.$p->listRows;
$voList = $Model->query($sql);
2.左查询
$model=M(‘picture‘);
$lists=$model->alias(‘p‘)->join(‘LEFT JOIN cgw_terms t on p.parent_id=t.term_id‘)->join(‘LEFT JOIN cgw_users u on p.post_author=u.id‘)->field(‘p.*,t.name,u.user_login‘)->order(‘p.post_modified desc‘)->page($nowpage, $limits)->select();
时间: 2025-01-04 15:26:47