查询语言.table

函数原型

public function table($mixTable, $mixCols = '*');

指定数据表

# SELECT `posts`.* FROM `posts`
Db::table('posts')->

getAll();

# SELECT `posts`.* FROM `mydb`.`posts`
Db::table('mydb.posts')->

getAll();

# SELECT `p`.* FROM `mydb`.`posts` `p`
Db::table(['p' => 'mydb.posts'])->

getAll();

指定字段

# SELECT `posts`.`title`,`posts`.`body` FROM `posts` 
Db::table('posts','title,body')->getAll();

# SELECT `posts`.`title` AS `t`,`posts`.`name`,`posts`.`remark`,`posts`.`value`  FROM `mydb`.`posts`
Db::table(
    'mydb.posts',
    ['t'=> 'title','name','remark,value']
)->

getAll();
上次更新: 2018/11/14 上午9:23:00