Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 4th, 2003, 04:02 PM
schwagomat schwagomat is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 schwagomat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP/MySQL problem with UNION

Hi,

I have a problem with following mySQL-statement:

"(SELECT
*, beitraege.id AS nr
FROM
beitraege, tipper
WHERE
tipper_id = tipper.id
AND forum_id = 1
AND beitraege.id > 72
ORDER BY
gesendet ASC
LIMIT
5)

UNION

(SELECT
*, beitraege.id AS nr
FROM
beitraege, tipper
WHERE
tipper_id = tipper.id
AND forum_id = 1
AND beitraege.id <= 72
ORDER BY
gesendet DESC
LIMIT
10)

ORDER BY
gesendet DESC;"

It is surprising that it's not a problem on my local environment but results in following error message on my host server:

"error: 1064 - You have an error in your SQL syntax near '(SELECT *, beitraege.id AS nr FROM beitraege, tipper WHERE ' at line 2"

Does somebody know how to get rid of this error message...???? btw: the same statement without UNION works... Thanx for your help!!!

BR
schwagomat

Reply With Quote
  #2  
Old November 4th, 2003, 05:20 PM
honcho's Avatar
honcho honcho is offline
Contributing User
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Cape Cod
Posts: 1,347 honcho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 2 sec
Reputation Power: 3
RE: PHP/MySQL problem with UNION

What version of MySQL sre you using? UNION was added in 4.0.0

Reply With Quote
  #3  
Old November 4th, 2003, 05:41 PM
schwagomat schwagomat is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 schwagomat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: PHP/MySQL problem with UNION

honcho,

thank you very much for your hint, that's it!!!
My host uses version 3.23.44

Thanx again
schwagomat

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > PHP/MySQL problem with UNION


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT