A
A
Alexander Verbitsky2018-07-04 16:29:41
Yii
Alexander Verbitsky, 2018-07-04 16:29:41

Outputting data from the first database table that is not in another, related table?

There is a query to the database
which, from one table, selects values ​​that are not in another table:

SELECT * FROM parameters
WHERE NOT EXISTS
(
    SELECT * FROM userparam
    WHERE userparam.parameters_id = parameters.id
          AND userparam.user_id = 42
);

how to write this request through yii2 methods??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-07-04
@VerbAlexVlad

Yes, and write, why bind QueryBuilder here if Connection has a createCommand ($ sql) method, which is just right for you.
https://www.yiiframework.com/doc/api/2.0/yii-db-command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question