DEV Community

John Ding
John Ding

Posted on

Custom Query with Strapi V3

Below code can be used in controller:

const knex = strapi.connections.default;
const result = await knex('articles_tags__tags_articles as atta')
.where('tag_id', 2)
.join('articles', 'atta.article_id', 'articles.id')
.select('articles.*')

https://docs-v3.strapi.io/developer-docs/latest/development/backend-customization.html#queries

Top comments (0)