Posts filed under 'SQL'
How to Concatenate Two String Values in SQL
(The following example was tested in SQLite, but it should work for most versions of SQL.)
The syntax for combining two string values is the following.
SELECT Column1 || Column2
FROM TheTable
1 comment July 12, 2008
How to Do an IF Statement in SQL
(The following example has been tested in SQLite, but it should work for most versions of SQL.)
Technically there is not a way to do IF statements in the SQLite query language like there is in some other versions of SQL. But you can essentially do it with the CASE statement. The following statement is similar to doing an IF, ELSE IF, ELSE statement.
SELECT (CASE InRome
WHEN ‘Yes’ Then ‘Do As the Romans Do’
WHEN ‘No’ Then ‘Do As the French Do’
ELSE ‘Who knows what to do’
)
Add comment July 12, 2008