core
db
html
utility
SqlAbstract::whereIn
public SqlAbstract whereIn
( string $column, array $values )
IN演算子による条件の指定を行います。
第二引数に複数の値を配列で指定することにより、すべての値のいずれかに合致する条件を指定することができます。
$ages = array(20, 21, 22, 23, 24, 25);
$select->where('name', 'taro');
$select->whereIn('age', $ages);
→WHERE (name = 'taro') AND (age IN (20, 21, 22, 23, 24, 25))
第二引数に複数の値を配列で指定することにより、すべての値のいずれかに合致する条件を指定することができます。
$ages = array(20, 21, 22, 23, 24, 25);
$select->where('name', 'taro');
$select->whereIn('age', $ages);
→WHERE (name = 'taro') AND (age IN (20, 21, 22, 23, 24, 25))
パラメーター
| 名前 | 型 | 内容 |
|---|---|---|
| $column | string | 条件比較対象の列名を指定します。 |
| $values | array | 第一引数で指定した列に対する複数の値を配列で指定します。 |
返り値
自分自身のインスタンスを返します。