|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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... |
|
#2
|
|||
|
|||
|
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. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Error in MySQL SELECT UNION Statment |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|