SQLite - где предложение не работает с двумя столбцами - PullRequest
0 голосов
/ 03 декабря 2018

В sqlite у меня есть запрос:

select * FROM notification_invoice where (notificationDate, ownerKey) IN (
  select distinct notificationDate, ownerKey FROM notification_invoice where providerId in ("12345","6789") 
)

Но я получаю ошибку:

Error: [SQLITE_ERROR] SQL error or missing database (near ",": syntax error)
SQLState:  null
ErrorCode: 1

1 Ответ

0 голосов
/ 03 декабря 2018

Я не думаю, что SQLite поддерживает кортежи с in.Просто используйте exists:

select ni.* 
from notification_invoice ni
where exists (select 1
              from notification_invoice ni2
              where ni2.notificationDate = ni.notificationDate and
                    ni2.ownerKey and ni.ownerKey and
                    ni2.providerId in ('12345', '6789') 
             );
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...