A
A
Anton89892017-08-13 13:57:13
Yii
Anton8989, 2017-08-13 13:57:13

How to select all values ​​for a given field?

Good afternoon. Let's assume there is a table
id title subtitle description
1 11 14 17
2 12 15 18
3 13 16 19
How would a select query in Yii look like if you need to pick up all the values ​​of the description field, i.e.
you need to pick up 17,18,19. Thanks in advance)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Tokmakov, 2017-08-13
@NPC

Model::find()->select(['description'])->all();

M
Maxim Timofeev, 2017-08-14
@webinar

Option Andrey Tokmakov selects all "description". Here is an option that will select everything where description is 17 or 18 or 19:

$arr = [17,18,19];
$model = Model::find()->where(['description'=>$arr])->all();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question