E
E
EVOSandru62018-09-07 10:33:20
Yii
EVOSandru6, 2018-09-07 10:33:20

How to execute JSON_EXTRACT IS NO Null in Yii2 condition?

Hello,
I'm trying this:

$query->andWhere(
'not', [new Expression("JSON_EXTRACT({$table}.datas, '$.someParam')") => null]],
)

I catch an error:
Operator 'JSON_EXTRACT({{%SUBACC}}.DATA, '$.someParam')' requires two operands.

Note - a couple of working options, but according to the condition that do not satisfy me, I repelled from them:
['is', new Expression("JSON_EXTRACT({$table}.datas, '$.essomeParamb')"), null],

and
['like', new Expression("JSON_EXTRACT({$table}.data, '$.someParam')"), $someData],

Tell me please!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EVOSandru6, 2018-09-07
@EVOSandru6

['is not', new Expression("JSON_EXTRACT({$table}.data, '$.someParam')"), null],

M
Maxim Timofeev, 2018-09-07
@webinar

=> nulldoes not work
, nulland
the error that the second operand is not set. What do you think?
https://www.yiiframework.com/doc/api/2.0/yii-db-co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question