Question: in SQLite - can I somehow calculate time difference between two timestamps in WHERE statement?

I tried something like:

```
SELECT * FROM table WHERE (strftime("%s","now") - strftime("%s", last_update_timestamp)) > 300

```

But it doesn't seem to work :(

Thanks for help!

Answer: 
Try including purchase\_id on purchaseProducts fields. When you use fields: {key: true} you exclude all the other fields, then the ORM(ODM in case if you use a non-relational database) can't make the join because it needs the foreignKey to do that.

Example (the fields notation that I use is equal to `fields:{key: true}`) : 

```
{
   "include":[
      {
         "relation":"userCourses",
         "scope":{
            "offset":0,
            "limit":100,
            "skip":0,
            "order":[
               "id"
            ],
            "fields":[
               "id",
               "user_id",
               "group_id"
            ],
            "include":[
               {
                  "relation":"group",
                  "scope":{
                     "fields":[
                        "id",
                        "otherField" 
                     ]
                  }
               }
            ]
         }
      }
   ]
}

```
This is the final solution working

```
return this.vendorRepository.purchases(id).find({
      include: [{

        relation: 'purchaseProducts',
        scope: {
          fields: { id: false },
          include: [{
            relation: 'products',
            scope: {
              fields: { product_id: true, name: true }
            }
          }],

        },

      },

      ]
    });

```