4

Can I concat two or more columns in Android sqlite ? eg select columna++ columnb as columnc from table

1

1 Answer 1

16

Try select columna || columnb as columnc from table.

Sign up to request clarification or add additional context in comments.

2 Comments

ERROR/AndroidRuntime(264): Caused by: java.lang.IllegalArgumentException: column 'TITLE || BEGIN as BLABLA' does not exist
Not sure why you are having problems: Cursor mCursor = mDb.rawQuery("SELECT *, \""+ KEY_NAME + "\" || \""+KEY_DESC + "\" AS val FROM "+DATABASE_TABLE_LOGS + " ORDER BY " + order, null); works for me. I can extract the val column from the resulting cursor. You might need to escape the columns as I did above (using double quotes).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.