O MySQL 5 está mais rígido quanto à leitura de queries. Por este motivo uma query que não esteja totalmente estruturada pode apresentar algum erro, o que não ocorre no MySQL 4, pois esta versão possui um tipo diferente de análise.

Vamos supor que você esteja executando a query abaixo:

SELECT count( DISTINCT p.products_id ) AS total   FROM products p   LEFT JOIN manufacturers m   USING ( manufacturers_id ) , products_description pd   LEFT JOIN specials s ON p.products_id = s.products_id,  categories c, products_to_categories p2c   WHERE p.products_status = '1'   AND p.products_id = pd.products_id   AND pd.language_id = '4'   AND p.products_id = p2c.products_id   AND p2c.categories_id = c.categories_id   AND (   (   pd.products_name LIKE '%dvd%'   OR p.products_model LIKE '%dvd%'   OR m.manufacturers_name LIKE '%dvd%'   ) )

Ela seria executada normalmente no MySQL 4, porém, ao executá-la no MySQL 5 ocorre o seguinte erro:

    Para solucionar este problema é necessário realizar uma pequena mudança na estrutura da query removendo as tabelas existentes entre os JOIN’s e colocando-as logo após, deixando a query com uma estrutura mais lógica como mostra abaixo:

    SELECT count( DISTINCT p.products_id ) AS total   FROM products p   LEFT JOIN manufacturers m USING ( manufacturers_id )   LEFT JOIN specials s ON (s.products_id = p.products_id),   products_description pd, categories c, products_to_categories    p2c   WHERE p.products_status = '1'   AND p.products_id = pd.products_id   AND pd.language_id = '4'   AND p.products_id = p2c.products_id   AND p2c.categories_id = c.categories_id   AND (   (   pd.products_name LIKE '%dvd%'   OR p.products_model LIKE '%dvd%'   OR m.manufacturers_name LIKE '%dvd%'   )   )

    Qualquer dúvida em relação ao assunto, entre em contato conosco através do Atendimento

    Veja também

    Esse artigo ajudou você?

    39 respostas para “Por que consigo executar uma determinada query no MySQL 4, mas não consigo executá-la no MySQL 5?”

    1. Big Bud Feminized Cannabis Seeds

      Way cool! Some extremely valid points! I appreciate you penning this post and also the rest of the website is also really good.

    2. Pest Control Jim

      This was awesome. Look forward to more posts like this! See ya!

    3. free horror

      Hello there, I believe your website could be having web browser compatibility issues. Whenever I look at your web site in Safari, it looks fine however when opening in Internet Explorer, it’s got some overlapping issues. I merely wanted to give you a quick heads up! Apart from that, excellent blog!

    4. Hung Nipper

      Having read this I thought it was really enlightening. I appreciate you finding the time and energy to put judi billiard online this content together. I once again find myself personally spending way too much time both reading and leaving comments

    5. Shaquita Behymer

      An adrenaline-fueled adventure that captivates you without a single explosion and leaves you completely satisfied.

    6. Kermit Vanbibber

      We will provide deal reviews, deal coaching, and follow up to ensure you win the deals you can’t afford to lose.

    7. Charlotte NC exterminators

      If you are looking for the best extreminator company, look no more. These guys are awesome! The best you’ll find.

    8. hicbdbye cbd for sale

      I was recommended this website via my cousin. I am not positive whether or not this put up is written by means of him as no one else recognise such unique approximately my difficulty. You’re amazing! Thank you! cbd oil for sale buy cbd

    9. Pretty Gaming

      Way cool! Some very valid points! I appreciate you writing this write-up plus the rest of the site is also very good.

    10. Steven Faivre

      Hello! I merely would like to provide a huge thumbs up for your excellent info you’ve got here during this post. I will be returning to your website for more soon.

    11. Last mile delivery

      Yesterday, while I was at work, my cousin stole my iphone and tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views. I know this is entirely off topic but I had to share it with someone!

    12. James Taylor

      Hello! I enjoyed your blog post. Keep making stuff like this. I’ll be back to see more articles like this one. It was very original. TTYL!

    13. Margaret Linstrom

      fantastic points altogether, you just gained emblem reader. What would you suggest in regards to your post that you made a few days ago? Any certain?

    14. Katherine Hatfield

      You completed various nice points there. I did a search on the subject matter and found mainly folks will agree with your blog.

    15. LANKELEISI en venta

      Hi there, just was aware of your blog thru Google, and found that it’s really informative. I’m gonna watch out for brussels. I will appreciate should you continue this in future. Lots of folks can be benefited out of your writing. Cheers!

    16. Shengmilo for sale

      Thanks for the sensible critique. Me & my neighbor were just preparing to do a little research on this. We got a grab a book from our area library but I think I learned more from this post. I’m very glad to see such great information being shared freely out there.

    17. 슬롯

      Best view i have ever seen !

    18. Snapchat Kupidgirls

      Thanks for sharing the information. I love sucking dick btw hmu

    19. is irs open

      You actually make it appear really easy along with your presentation but I to find this matter to be actually one thing that I feel I’d by no means understand. It seems too complicated and extremely vast for me. I am taking a look ahead to your subsequent publish, I will try to get the dangle of it!

    20. plumbing and heating see this website

      You made some first rate factors there. I regarded on the internet for the problem and located most individuals will go together with along with your website.

    21. he has a good point

      I simply want to say I am beginner to weblog and really liked your blog. More than likely I’m want to bookmark your blog post . You really have superb article content. Appreciate it for sharing with us your blog.

    22. local plumbers like it

      wonderful put up, very informative. I’m wondering why the opposite specialists of this sector do not realize this. You must proceed your writing. I’m sure, you’ve a great readers’ base already!

    23. home warranty companies reviews

      Very nice post. I just stumbled upon your blogg and wanted to say
      that I’ve truly enjoyed surfing around your blog posts.
      In any case I will be subscribing to your feed and I hope you write
      againn very soon!

    24. VitalFlow

      Nice post. I learn something totally new and challenging on blogs I stumbleupon every day. It’s always exciting to read articles from other writers and practice something from their web sites.

    25. foundation repair quotes

      I am often to running a blog and i actually appreciate your content. The article has really peaks my interest. I am going to bookmark your site and keep checking for new information.

    26. Saul

      I have found very interesting your article.It’s pretty worth enough for me.
      In my view, if all website owners and bloggers made good content as
      you did, the web will be a lot more useful thaan ever before.

    27. 마사지알바

      You’re therefore amazing. Oh my God. Lord bless you.

    28. Playset assembly service

      Hello there, You’ve done an incredible job. I’ll certainly digg it and personally recommend to my friends. I am confident they will be benefited from this site.

    29. best home renovations

      Wow that was odd. I just wrote an incredibly long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say superb blog!

    30. roadside assistance

      Nice blog right here! Additionally your site so much up fast! What web host are you the usage of? Can I am getting your affiliate link to your host? I wish my website loaded up as fast as yours lol

    31. alberta car towing

      I was suggested this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks!

    32. digital marketing naics code

      Awesome blog! Do you have any tips for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely confused .. Any suggestions? Thank you!

    33. more tips here

      I simply want to mention I am very new to blogging and really liked your web page. Very likely I’m planning to bookmark your site . You surely have wonderful writings. Thanks for sharing your blog.

    34. check this link right here now

      Hi there, I found your blog via Google while searching for a related topic, your website came up, it looks good. I’ve bookmarked it in my google bookmarks.

    35. Sam Manor

      I just want to say I am new to blogging and definitely savored this web site. Probably I’m going to bookmark your website . You absolutely come with terrific writings. Many thanks for sharing your web-site.


    Comente sobre este conteúdo! Escreva o que pensa, complemente, vamos discutir. O conhecimento é livre!