Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7595309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:38:28+00:00 2026-05-30T21:38:28+00:00

Again I’m having troubles while migrating from Access to MySQL . The following SQL

  • 0

Again I’m having troubles while migrating from Access to MySQL.

The following SQL Statements works fine with Access:

SELECT *
FROM tbl_content 
WHERE contentID IN (
     SELECT contentID
     FROM tbl_tags
     WHERE Bezeichnung IN (
              SELECT Bezeichnung
              FROM tbl_tags t2
              WHERE t2.contentID= " & contentID & ")
     AND contentID <> " & contentID & ")
AND Status = 1
ORDER BY Datum DESC LIMIT 0,5;

In MySQLthe performance is really slow. Any ideas for help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:38:29+00:00Added an answer on May 30, 2026 at 9:38 pm

    You have answered your own question in the title. Generally speaking, MySQL does not optimise IN (Subquery) as well as JOINS so you would be better off using JOIN

    SELECT  *
    FROM    tbl_content t1
            INNER JOIN
            (   SELECT  ContentID
                FROM    tbl_tags t1
                        INNER JOIN
                        (   SELECT  Bezeichnung 
                            FROM    tbl_tags t2 
                            WHERE   t2.contentID = " & contentID & "
                            GROUP BY Bezeichnung
                        ) t2
                            ON t1.Bezeichnung = t2.Bezeichnung
                WHERE   contentID <> " & contentID & "
                GROUP BY ContentID
            ) t2
                ON t2.ContentID = t1.ContentID
    WHERE   Status = 1
    ORDER BY Datum DESC LIMIT 0,5;
    

    Also check that the relevant columns are indexed for increased performance.

    EDIT

    Further more I think EXISTS May be more efficient still in MySQL, but EXPLAIN should show more:

    SELECT  *
    FROM    tbl_content t1
    WHERE   EXISTS
            (   SELECT  1
                FROM    tbl_tags t2
                WHERE   EXISTS
                        (   SELECT  1
                            FROM    tbl_tags t3
                            WHERE   t2.contentID = " & contentID & "
                            AND     t2.Bezeichnung = t2.Bezeichnung
                        ) 
                AND     t1.ContentID = t2.ContentID
            ) 
    AND     Status = 1
    AND     t1.contentID <> " & contentID & "
    ORDER BY Datum DESC LIMIT 0,5;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello again ladies and gents! OK, following on from my other question on ASP.NET
again, this qn was from the practice qns in the mysql certification guide book
Again, to continue with my mysql noob questions :) I want the following to
again. I have a menu that I'm building. Everything works fine, except for the
me again, sorry :) I was using dom parser to get xml from web
Me again. The sliding in works like a charm. But I want to extend
Again pulling my hair out due to some Flex/AS3 weirdness. The following code does
again me: following array; $myArray = array('FOO', 'BAR', 'HELLO'); i need: $myArray['FOO']['BAR']['HELLO'] = 0;
Again, I am a java n00b and I am trying to learn from scratch
again im having a issues, I'm trying to get when a menu item is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.