how to combine two columns in sqlite in python?
How can I combine two columns in sqlite3? I know I can use +
in a select
statement, but when I've t开发者_开发知识库ried this code in python :
select first+last as name from users
it gave me 0
.
I have tried this statement
select first||" "||last as name from users
I'm getting error.
I want to show firstname and last name in one column, something like this:
'tara.panagop@where.com', 'tara panagop',
as
binds tighter than ||
so this needs parens:
select (first||" "||last) as name from users
ecape "
in quotes as \"
:
cur.execute("select (first||\" \"||last) as name from users")
If you have null rows you might want to try
select (coalesce(first,'')||" "||coalesce(last,'')) as name from users
精彩评论