mercredi 24 août 2016

sql IF ELSE error

I would like to write an IF query, but what's wrong with this query?

SELECT
IF(Emp.Name is not null)     
        ((Emp.Name) + '_' + (Emp.LastName)) as ID
else
   Emp.ID

And I get this error:

Incorrect syntax near the keyword 'IF'.

why is that?

THANK YOU!

Aucun commentaire:

Enregistrer un commentaire