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

Reply via email to