Answer the question
In order to leave comments, you need to log in
How to compare two rows from the same table without additional join or from?
Suppose there are a number of conditions that limit the set to 5 - 10 rows
The table has a large data size
Select a row where status is OPEN, but if there is another row with status status - CLOSED
Where statusId is equal for two rows.
Is it possible to work with a selection of 5-10 rows and not join a huge table?
Answer the question
In order to leave comments, you need to log in
You can fill in the query result, these same 5-10 lines, into a temporary table and continue working with it. Then you don't have to join a large table.
The question, as always, is stupid.
Sounds like "can you eat soup without a spoon?". And further in justification ridiculous fears.
You should not be afraid to "join a huge table" but learn how to optimize queries.
In this case, there is no problem with the join.
If it slows down, put the desired index, at least by statusId
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question