Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite problem selecting two columns as one

Tags:

sqlite

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'


for those who are trying to use the (working) solution of @merkuru

SELECT (column1 || " " || column2) AS expr1 FROM your_table;

in eclipse or another editor:

you have to cancel the " with \

something like:

SELECT (column1 || \" \" || column2) AS expr1 FROM your_table;

that's works perfect


This worked for me in the where clause:

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