About 40,600 results
Open links in new tab
  1. mysql - How does LEFT JOIN with WHERE clause works?

    Feb 27, 2017 · If name is indexed and 'e' is somewhat unique then do that first is more efficient. This is different SELECT * FROM tableA LEFT JOIN tableB ON tableB.id = tableA.id WHERE …

  2. Speed up LEFT JOIN with OR operator in ON clause

    Jan 16, 2019 · I have a query that uses a LEFT JOIN with an OR operator within the ON clause. When commenting out the OR operator the query runs in ~150ms. With the OR operator kept …

  3. mysql - Subquery inside a select vs left join - Database …

    The one in the JOIN is a derived table - it will be executed only once and materialized into a temporary table, which will then be joined to your other tables. If the query is fast (can use …

  4. mysql - How to optimize very slow SELECT with LEFT JOINs over …

    First thing - get rid of the LEFT join, it has no effect as you use all the tables in your WHERE condition, effectively turning all the joins to INNER joins (optimizer should be able to …

  5. mysql - Left Join with only one of multiple matches in the right …

    Jul 10, 2023 · In short: I need a left join that takes all entries of table “main” and joins them with the name that has the smallest, greater than 0, position, if there is one.

  6. How would I use "LEFT JOIN" and "IF NOT EXISTS" in this case?

    Jan 22, 2023 · To accomplish that with a LEFT JOIN you need to put rides on the left side of the join. The table you don't want to be filtered by the LEFT JOIN always goes on the left side. …

  7. mysql - SELECT only IS NOT NULL columns with LEFT JOIN

    May 19, 2022 · Firstly - use INNER JOIN instead of LEFT (study the difference carefully !!!). Then, if some column in some options table may contain NULL, add according WHERE condition.

  8. mysql - How to optimizate COUNT query with multiple LEFT JOIN ...

    May 28, 2021 · How to optimizate COUNT query with multiple LEFT JOIN Ask Question Asked 4 years, 6 months ago Modified 4 years, 6 months ago

  9. mysql - Join 2 tables and get the latest record - Database ...

    Dec 7, 2017 · I'm trying to get the resultant query which support to get the selected columns from both tables by join operation. but when I tried i'm getting the duplicate records associated with …

  10. mysql - Limit left join for multiple rows - Database Administrators ...

    Jun 6, 2019 · Since MySql doesn't support main alias reference in subquery is a bit challenging to create query with multiple rows where you have to limit rows of left join tables. Let's overview …