4

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

czesław
  • 45
  • 1
  • 7

1 Answers1

16

Try select columna || columnb as columnc from table.

Femi
  • 64,273
  • 8
  • 118
  • 148
  • ERROR/AndroidRuntime(264): Caused by: java.lang.IllegalArgumentException: column 'TITLE || BEGIN as BLABLA' does not exist – czesław May 09 '11 at 11:51
  • 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). – Femi May 09 '11 at 14:23