How to translate this to mySQL:

--------------------------------------------------------------
IF NOT EXISTS
(
        Select Number From Results Where GameID=1
)
begin

INSERT INTO Results
        (
                GameID,
                Date,
                Number
        )
        VALUES
        (
                1,
                @Date,
                @Number
        )

end
--------------------------------------------------------------

I can figure if there exist any records in results table:

Select @n:= Count(Number) From Results Where GameID=1;

But there is no way to do following:

If ( @n >0 )
{

INSERT INTO Results
        (
                GameID,
                Date,
                Number
        )
        VALUES
        (
                1,
                @Date,
                @Number
        )

}

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