I'm trying to run this :
IF EXISTS (SELECT id_commande FROM historique WHERE id_commande = 57 AND device = 70635601)
BEGIN
SELECT id_commande FROM historique WHERE id_commande = 57 AND device = 70635601
END
ELSE
BEGIN
SELECT (MAX(id_commande)+1) FROM historique
END
I hope you can understand what I want to do. My problem is that it always gives me back Erreur dans la requĂȘte (1064): Syntax error near 'BEGIN SELECT 1 END ELSE BEGIN SELECT 2 END' at line 2
.
Thank you for helping me !