I have subjects table and tutorials table in SQLite database. I am trying to select current tutorial. There are my tables
Subjects table:
------------------- | id | name | ------------------- | 1 | Chemistry | | 2 | Physic | -------------------
Tutorials table:
----------------------------------------- | id | name | subj_id | completed | ----------------------------------------- | 1 | chapter 1 | 1 | 1 | | 2 | chapter 2 | 1 | 0 | | 3 | chapter 3 | 1 | 0 | | 4 | chapter 1 | 2 | 1 | | 5 | chapter 2 | 2 | 1 | | 6 | chapter 3 | 2 | 0 | | 7 | chapter 4 | 2 | 0 | -----------------------------------------
My current eloquent is:
$query->where('completed', false)->groupBy('subj_id')->get();
And it returns the following:
-----------------------------------------
| id | name | subj_id | completed |
-----------------------------------------
| 3 | chapter 3 | 1 | 0 |
| 7 | chapter 4 | 2 | 0 |
-----------------------------------------
Now I wish to select id 2 and 6.
-----------------------------------------
| id | name | subj_id | completed |
-----------------------------------------
| 2 | chapter 2 | 1 | 0 |
| 6 | chapter 3 | 2 | 0 |
-----------------------------------------
How could I get id 2 and 6 using sqlite?