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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 15th, 2003, 02:46 PM
al042077 al042077 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Omaha, NE
Posts: 23 al042077 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 sec
Reputation Power: 0
Send a message via Yahoo to al042077
Error in MySQL SELECT UNION Statment

I have the following script on a page:

include("database_connection.php");
$stmt = "(SELECT * FROM tbl_a WHERE field_b != 'Other' ORDER BY field_b)";
$stmt .= " UNION (SELECT * FROM tbl_a WHERE field_b = 'Other')";
$rs = mysql_query($stmt) or die (mysql_error());

I have Apache/MySQL/PHP on two computers; each has the same versions. I can't figure out why this script works on one but the other says, "You have an error in your SQL syntax near '(SELECT * FROM tbl_a WHERE field_b != 'Other' ORDER BY field_b' at line 1"

I know I have an active database connection because I can get other pages to show data properly. I know the data is there because first, I dumped from the working computer, and second, I checked through MySQL monitor.

Anyone know what I'm doing wrong with my SQL statement?

Errrr...

Reply With Quote
  #2  
Old May 15th, 2003, 10:10 PM
al042077 al042077 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Omaha, NE
Posts: 23 al042077 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 sec
Reputation Power: 0
Send a message via Yahoo to al042077
RE: Error in MySQL SELECT UNION Statment



I am very sorry!! No need to respond - I found my problem; it was actually two-fold.

First, I am an idiot.
Second, I have MySQL 4.0.12 at home, but had 3.23 at the office where I was having trouble. Simple upgrade fixed that.

Again, I'm sorry.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Error in MySQL SELECT UNION Statment


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 5 hosted by Hostway