List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 14 2001 1:45pm
Subject:Re: INSERT problem
View as plain text  
MySQL does not support multi table updates yet either.

Yosi Oren wrote:

> Hi,
> You are trying to use nested select for that update wich MySQL do not
> support insted use :
> update table set field = value from table inner join table where bla = bla
> .....
> 
> Sincerely,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Yosi Oren
> VP,R&D manager
> Tel         : +972 4 908 2180 ext 217
> Fax         : +972 4 908 2181
> Mobile  : +972 54 533190
> E-mail    :  <yosi@stripped> 
> Web      :  www.spiralsolutions.com 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> -----Original Message-----
> From: Mariusz Muszalski [mailto:mariusz@stripped]
> Sent: Tuesday, August 14, 2001 12:44 PM
> To: mysql@stripped
> Subject: INSERT problem
> 
> 
> Look at this MS SQL:
> 
> Declare @BF char(10)
> Declare @BL char(10)
> 
> SET ROWCOUNT 1
> Select @BF=Date From Results Where GameID=1 Order by Date ASC
> Select @BL=Date From Results Where GameID=1 Order by Date DESC
> 
> Select @BF As BF, @BL As BL
> 
> --------------------------
> 
> Now wonna to implement above to mySQL:
> I used temprary table (is there any other way?)
> 
> CREATE TEMPORARY TABLE tmp(BF char(10) not null, BL char(10) not null);
> 
> INSERT INTO tmp (BF) SELECT Date From Results Where GameID=1 Order by Date
> ASC LIMIT 1;
> INSERT INTO tmp (BL) SELECT Date From Results Where GameID=1 Order by Date
> DESC LIMIT 1;
> 
> SELECT * from tmp;
> DROP TABLE tmp;
> 
> --------------------------
> 
> problem is INSERT INTO creates a new record every time...I tried to use
> UPDATE in instead the second INSERT:
> 
> UPDATE tmp SET BL = (SELECT Date From Results Where GameID=1 Order by Date
> DESC LIMIT 1);
> 
> But there is error in the syntax....
> 
> Questions: is there only TEMPORARY TABLE way for make it? What is wrong with
> this UPDATE?
> 
> Cheers,
> Mariusz Muszalski
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread82470@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-yosi=spiralsolutions.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread82474@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
INSERT problemMariusz Muszalski14 Aug
  • Re: INSERT problemGrigory Bakunov15 Aug
RE: INSERT problemYosi Oren14 Aug
  • Re: INSERT problemGerald Clark14 Aug
Re: INSERT problembtjones15 Aug