How to select everything but top X in MYSQL

Asked

Viewed 44 times

0

I’m scheduling a personal scheduling project and don’t know how to implement a SELECT in all tasks other than the top 5 of the day.

How do I implement this in mysql?

For example, I have a SELECT * FROM Schedules here : inserir a descrição da imagem aqui I want to select all after the 5, but without relying on Schedule_id because it can vary a lot in the actual use of the program.

  • It would be interesting to inform the structure of the tables you use to get in the top 5

  • Thanks for the tip, I’ll edit now to include it

1 answer

1


I found a similar question in English.

I decided as follows following what was written.

SELECT * FROM Schedules WHERE Schedule_id NOT IN (
    SELECT Schedule_id FROM (
        SELECT Schedule_id FROM Schedules ORDER BY Schedule_id Limit 5
    ) AS x
)
  • You can accept your own answer if you want to too! But you better hope for some other better answer first.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.