Jump to content


Photo

MySQL version problems


  • Please log in to reply
3 replies to this topic

#1 dtgreenwood

dtgreenwood
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationNorth Yorkshire, UK

Posted 05 August 2006 - 04:49 PM

Hello everyone.
After heading over to mysqlfreaks for help and finding the forums shut down :( I've been redirected over here.

I'm having a problem with MySQL versions. I run MySQL 5.0.21-community-nt on my localhost for development and my web sites server runs MySQL 3.23.58. Until now this hasn't been a problem.

Having used the following SQL statement on my localhost and having it return correct results.
SELECT distinct a.articleid, a.articleauthorid, a.articletitle, a.articlecontent, a.articledate, a.articleenclosuretitle, a.articleenclosureuri, a.articleenclosurelength, u.userid, u.username, u.userstatus, (SELECT COUNT(*) FROM comments WHERE comments.articleid = a.articleid)AS articlecomments FROM comments c, articles a, users u WHERE a.articleauthorid = u.userid ORDER BY articledate DESC LIMIT 0,3
I updated my website to use the new SQL with no luck. My web site's MySQL server gives me the following error:
#1064 - You have an error in your SQL syntax near 'SELECT COUNT(*) FROM comments WHERE comments.articleid = a.articleid) AS articlec' at line 1

My question is how would I replicate the same results of the above statement for my web sites server?

If anymore information is required just let me know. Thanks in advance.
dtgreenwood.

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 05 August 2006 - 07:41 PM

You can't use subqueries in 3.23 -- you'll need to rewrite as a JOIN.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 dtgreenwood

dtgreenwood
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationNorth Yorkshire, UK

Posted 05 August 2006 - 09:35 PM

I'd feared as much. Any ideas on how to do this? I've been trying with lots of variations, none of which give the desired result.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 06 August 2006 - 12:48 AM

I'll take a look later on tonight... I'm not at a location with access to my sql box.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users