How to avoid “Using temporary” in many-to-many queries?

前端 未结 4 631
悲&欢浪女
悲&欢浪女 2020-12-02 01:03

This query is very simple, all I want to do, is get all the articles in given category ordered by last_updated field:

SELECT
    `articles`.*
FR         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 01:42

    I assume you have made the following in your db:

    1) articles -> id is a primary key

    2) articles_to_categories -> article_id is a foreign key of articles -> id

    3) you can create index on category_id

提交回复
热议问题