This content originally appeared on DEV Community and was authored by John Ding
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
This content originally appeared on DEV Community and was authored by John Ding
John Ding | Sciencx (2022-04-09T00:46:10+00:00) Custom Query with Strapi V3. Retrieved from https://www.scien.cx/2022/04/09/custom-query-with-strapi-v3/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.