tp6 多表查询

$fff =Db::table('ce')->alias('c')->join('admin ad','ad.id=c.id')->field('c.*')->where('c.name', 'a')->select();

$fff =Db::table('ce')->alias('c')->join('admin ad','ad.id=c.id')->join('biao3 b3','ad.id=b3.id')->field('c.*,b3.val yggg')->where('c.name', 'a')->select();//3表查询

//多条件查询
Db::table('ce')->alias('c')->join('admin ad','ad.id=c.id')->join('biao3 b3','ad.id=b3.id')->field('c.*,b3.val yggg')->where([
       	['c.name','=','a'],
       	['c.id','=','1']
       ])->select();

$tval= Db::table('ce')->where('id', 1)->value('name');// 直接获取记录 值

      $count = Db::name('ce')->count(); //不要条件 直接获取记录数

你可能感兴趣的:(tp6,php)