Skip to content

fields->field #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 3.3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/Components/Mysqli/Chain/fieldsMethod.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ meta:
- name: keywords
content: swoole|swoole 拓展|swoole 框架|EasySwoole mysqli|EasySwoole ORM|Swoole mysqli协程客户端|swoole ORM
---
# fields
# field

主要目的是查询时标识要返回的字段值

## 指定字段

```php
$builder->fields(['id','title'])->get('user_list');
$builder->field(['id','title'])->get('user_list');
```

## 设置别名

```php
$builder->fields(['id','title as notice'])->get('user_list');
$builder->field(['id','title as notice'])->get('user_list');
```

## 使用SQL函数

```php
$builder->fields(['id','SUM(score)'])->get('user_list');
$builder->field(['id','SUM(score)'])->get('user_list');
```

## 传参说明

方法原型
```php
function fields($fields)
function field($fields)
```

- $fields array|string 如果非数组时,只可传入一个字段名