i have problems with my sql-statement and coulnd't find a solution to this in the already asked questions here.
my statement is:
IF EXISTS (SELECT LastLogin FROM user WHERE Email = @mail)
SELECT LastLogin FROM user WHERE Email = @mail
ELSE INSERT INTO
`user`(LastLogin) VALUES ('00.00.0000') WHERE Email = @mail
END IF
tried:
CREATE Procedure lastlogin()
begin
IF EXISTS (SELECT LastLogin FROM fenutzer WHERE Email = @mail)
SELECT LastLogin FROM user WHERE Email = @mail
ELSE
INSERT INTO `user`(LastLogin) VALUES ('00.00.0000') WHERE Email = @mail
END IF;
call lastlogin()
LastLogin has the Datatype "DateTime".
i have the code inside a visual-studio-project (C#) inside an sql-command. i get the error that there is something wrong inside my sql-syntax (right syntax next to "else insert in"). but i cant figure out whats wrong