Android Question Concatenation of two field names in query

Pahbie

Member
Licensed User
Longtime User
Apologies if asked already.

i am trying to display the first and last names from a table and cannot figure out how to concatenate the two fields in a query
Prolly very simple but I am stumped!

I tried getstring but cannot seem to be able to concatenate both firstname and lastname. i've tried the & and + operators to no avail.
 

klaus

Expert
Licensed User
Longtime User
For SQLite you may have a look HERE.
Instead of using this:
B4X:
Query = "SELECT FirstName, LastName, City FROM persons"
ResultSet1.GetString("FirstName") & "  /  " & ResultSet1.GetString("LastName")

You could use this:
B4X:
Query = "SELECT FirstName || '  /  ' || LastName As FullName"
ResultSet1.GetString("FullName")
Do not worry about the colors above. The single quotes are not a comment.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…