Mysql doesn't support subqueries yet, except for the newest ALPHA release, which you can get at mysql.com Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 "Pay It Forward" mailto:gary.every@ingramentertainment.com http://accessingram.com > -----Original Message----- > From: Andreas Cahen [mailto:qube@space.ch] > Sent: Tuesday, May 13, 2003 4:40 PM > To: 'Maxim Maletsky' > Cc: php-db@lists.php.net > Subject: AW: Subquery trouble :) > > > Hi Maxim! > > > 3 questions: > > > 1. what DB is it for? Looks like Oralce to me :) > > 2. What sense can it make updating town_id to 910 on any row that > already contains it? 3. what is this 'Domain'? That could actually be > your syntax error. > > So far... 2 questions :) > > 1. I use mySQL, such subqueries were working the days I used to work > with Oracle, but those days are gone now :) > 2. Let me explain you the structure.. > > I got 3 tables involved... > > CREATE TABLE `details_domains_a` ( > `ID` int(10) NOT NULL auto_increment, > `Domain` varchar(255) NOT NULL default '', > . > . > Lotsa fields :) > . > . > > `town_ID` int(11) NOT NULL default '0', > PRIMARY KEY (`ID`) > ) TYPE=MyISAM AUTO_INCREMENT=370 ; > > CREATE TABLE `domains_a` ( > `domain` varchar(255) NOT NULL default '', > `name` varchar(255) NOT NULL default '', > `check` int(11) NOT NULL default '0', > `check_date` date NOT NULL default '0000-00-00', > `town_ID` int(11) NOT NULL default '0', > KEY `domain` (`domain`), > KEY `name` (`name`) > ) TYPE=MyISAM; > > CREATE TABLE `towns` ( > `town_ID` int(11) NOT NULL auto_increment, > `name` varchar(255) NOT NULL default '', > `check` int(11) NOT NULL default '0', > `check_date` date NOT NULL default '0000-00-00', > PRIMARY KEY (`town_ID`) > ) TYPE=MyISAM AUTO_INCREMENT=4171 ; > > > > > > And I need to do following: > > UPDATE details_domains_a SET town_id = 910 WHERE Domain IN ( > SELECT domain > FROM domains_a > WHERE town_id = 910 > ) > > > Maybe it's just a typo... :( > > > Cheers, > > Andreas Cahen > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >