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    :  <[EMAIL PROTECTED]> 
Web      :  www.spiralsolutions.com 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



-----Original Message-----
From: Mariusz Muszalski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 12:44 PM
To: [EMAIL PROTECTED]
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to