// 获取sql语句但不执行
$ipos_vip=$db->name('ipos_vip')
->alias('a')
->field('a.Id,a.xfcs,a.vpmc,a.sj,a.zjrq,a.xfje,a.birth,a.cz_dqje,c.khmc,d.dymc')
->join('ipos_qtlsd e','a.zd_id=e.zd_id','left')
->join('com_base_kehu c','e.zd_id=c.Id','left')
->join('ipos_dianyuan d','a.jsdy=d.Id','left')
->where($where)
->order('a.cz_dqje desc')
->fetchSql()
->select();
var_dump($ipos_vip);die;
// 获取执行后的sql语句
$ipos_vip=$db->name('ipos_vip')
->alias('a')
->field('a.Id,a.xfcs,a.vpmc,a.sj,a.zjrq,a.xfje,a.birth,a.cz_dqje,c.khmc,d.dymc')
->join('ipos_qtlsd e','a.zd_id=e.zd_id','left')
->join('com_base_kehu c','e.zd_id=c.Id','left')
->join('ipos_dianyuan d','a.jsdy=d.Id','left')
->where($where)
->order('a.cz_dqje desc')
->select()
->getLastSql();
var_dump($ipos_vip);die;
|