Subquery Problem With mysql-4.0 (Works with mysql-5.0)

2006-06-05 Thread MySQL Nexeia

I face one problem with mysql4.0

I've two tables, one called company and the other called favorites.  The
relation between those two tables is CO_ID on the company table and
MASTER_CO_ID on the favorites table. When I run the following query it works
fine on mysql-5.0 but it give error with mysql-4.0.

Query**
SELECT c.MASTER_CO_ID as Expr1 FROM company
LEFT OUTER JOIN (select MASTER_CO_ID,SLAVE_CO_ID from favorites where
MASTER_CO_ID = '1' GROUP BY MASTER_CO_ID,SLAVE_CO_ID) c ON company.CO_ID =
c.SLAVE_CO_ID
GROUP BY c.MASTER_CO_ID
***

Error with mysql4.0
#1064 - You have an error in your SQL syntax.  Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'select MASTER_CO_ID,SLAVE_CO_ID from favorites where MAS
***


I have two tables company and favorites, like

CREATE TABLE `company` (
 `CO_ID` varchar(36) NOT NULL default '',
 `CO_NAME` varchar(50) default NULL,
   PRIMARY KEY  (`CO_ID`),
 FULLTEXT KEY `CO_NAME`
(`CO_NAME`,`INDUSTRY_NAME`,`CO_ADDR1`,`CO_ADDR2`,`CO_PIN`,`CO_URL`,`CO_INFO`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


CREATE TABLE `favorites` (
 `FAV_ID` bigint(20) NOT NULL auto_increment,
 `MASTER_CO_ID` varchar(36) default NULL,
 `SLAVE_CO_ID` varchar(36) default NULL,
 PRIMARY KEY  (`FAV_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ;


Re: Subquery Problem With mysql-4.0 (Works with mysql-5.0)

2006-06-05 Thread Pooly

2006/6/5, MySQL Nexeia [EMAIL PROTECTED]:

I face one problem with mysql4.0

I've two tables, one called company and the other called favorites.  The
relation between those two tables is CO_ID on the company table and
MASTER_CO_ID on the favorites table. When I run the following query it works
fine on mysql-5.0 but it give error with mysql-4.0.

Query**
SELECT c.MASTER_CO_ID as Expr1 FROM company
LEFT OUTER JOIN (select MASTER_CO_ID,SLAVE_CO_ID from favorites where
MASTER_CO_ID = '1' GROUP BY MASTER_CO_ID,SLAVE_CO_ID) c ON company.CO_ID =
c.SLAVE_CO_ID
GROUP BY c.MASTER_CO_ID
***




MySQL 4.0.x does not support subquery. Subqueries are only supported
starting with 4.1.




Error with mysql4.0
#1064 - You have an error in your SQL syntax.  Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'select MASTER_CO_ID,SLAVE_CO_ID from favorites where MAS
***


I have two tables company and favorites, like

CREATE TABLE `company` (
  `CO_ID` varchar(36) NOT NULL default '',
  `CO_NAME` varchar(50) default NULL,
PRIMARY KEY  (`CO_ID`),
  FULLTEXT KEY `CO_NAME`
(`CO_NAME`,`INDUSTRY_NAME`,`CO_ADDR1`,`CO_ADDR2`,`CO_PIN`,`CO_URL`,`CO_INFO`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


CREATE TABLE `favorites` (
  `FAV_ID` bigint(20) NOT NULL auto_increment,
  `MASTER_CO_ID` varchar(36) default NULL,
  `SLAVE_CO_ID` varchar(36) default NULL,
  PRIMARY KEY  (`FAV_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=41 ;





--
http://www.w-fenec.org/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]