SQLite problem selecting two columns as one

Viewed 31040

Basic table with empname and empdpt.
In a Sql Server table, I can do Select empname + ' ' + empdpt as expr1 no problem.
Can't do the same using Sqlite!!
When I try to combine two columns [with data], I get back a 0.
I've tried in sqliteman and sqliteadmin as well as Server Explorer in VS.

4 Answers

Try using the following:

SELECT ("test" || " " || "test2") AS expr1 ;

Update

If these are columns you can do something similar: SELECT (column1 || " " || column2) AS expr1 FROM your_table;

Select empname || " " || empdpt as expr1 

The sqllite concat is the same as PostGreSQL ( || ) and not MYSQL or MSSQL 'CONCAT'

This worked for me in the where clause:

SELECT * FROM table_name WHERE(first_name || last_name) LIKE comparison_string;
Related