sql - syntaxe SQLite pour If Else condition

Mots clés : sqlsqlitesql

meilleur 4 Réponses sql - syntaxe SQLite pour If Else condition

vote vote

93

SELECT *,        CASE WHEN Password IS NOT NULL        THEN 'Yes'        ELSE 'No'        END AS PasswordPresent FROM myTable 
vote vote

89

select *  from myTable CASE WHEN Password != NULL THEN Password = 'Yes' ELSE Password = 'No' END; 
SELECT Field1,      Field2,     (CASE WHEN Password != NULL THEN          'Yes'       ELSE          'No'       END) as 'Password' FROM myTable; 
vote vote

80

UPDATE myTable SET Password = "YES" WHERE Password IS NOT NULL;     UPDATE myTable SET Password = "NO" WHERE PASSWORD IS NULL; 
vote vote

61

SELECT   Password,   IIF(Password IS NOT NULL, 'Yes', 'No') [HasPassword] 

Questions similaires