"Simon Longstaff" <[EMAIL PROTECTED]> wrote on 
10/28/2005 10:50:24 AM:

> I'm trying to run this :
> 
> SELECT DISTINCT A.B_IP FROM w3t_Posts A , w3t_Users B WHERE A.B_PosterID 
=
> B.U_Number and B.U_Username = 'user1' 
> UNION
> SELECT DISTINCT C.B_IP FROM w3t_Posts C , w3t_Users D WHERE C.B_PosterID 
=
> D.U_Number and D.U_Username = 'user2' 
> 
> and it's failing saying 
> 
> SQL Error: You have an error in your SQL syntax near 'UNION SELECT 
DISTINCT
> A.B_IP FROM w3t_Posts A , w3t_Users B WHERE A.B_PosterID ' at line 2
> SQL Error #: 1064
> Query: SELECT DISTINCT A.B_IP FROM w3t_Posts A , w3t_Users B WHERE
> A.B_PosterID = B.U_Number and B.U_Username = 'Simon' UNION SELECT 
DISTINCT
> A.B_IP FROM w3t_Posts A , w3t_Users B WHERE A.B_PosterID = B.U_Number 
and
> B.U_Username = 'MartyX' 
> 
> 
> I've been using DB2 SQL for ages.
> 
> 

According to the book for your version:
http://dev.mysql.com/doc/refman/4.1/en/index.html

The UNION keyword:
http://dev.mysql.com/doc/refman/4.1/en/union.html

Union is supported starting with version 4.0.0. Version 5.0 is the current 
production version of MySQL; it may be time to consider an upgrade. What 
do you think? If you are not interested in upgrading all the way to 5.0, 
4.1 was the leading production version until 5.0 was released. You may 
want to upgrade to just that....

http://dev.mysql.com/doc/refman/4.1/en/upgrade.html
or
http://dev.mysql.com/doc/refman/5.0/en/upgrade.html

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to