Share On Twitter Facebook Google+ LinkedIn Pinterest Tumblr Reddit
Question

I can not filter one input inside union of firstname and surname

Tags: query sqlite
Date:
Status:Resolved
Question Id:14

I have a table named users in my sqlite database. The table has id, firstname and surname columns. I want to filter in firstname + " " + surname .  I wrote this but not work.

SELECT * FROM users WHERE id like 'LINA TA%' or firstname + ' ' + surname like 'LINA TA %' 

I have a record firstname:LINA, surname:TANCREDI . Please help me

 

Answer
Date:
Correct:No

could you try this :

SELECT CONCAT(firstname, ' ', surname) as 'fullname' 
FROM customer WHERE fullname LIKE 'LINA TA%'
Answer
Date:
Correct:No

I've tried this and it gives me fullname column doesn't exist.

Answer
Date:
Correct:Yes

guys you should look at https://www.sqlitetutorial.net/sqlite-string-functions/sqlite-concat/

Concat function is different in sqlite. Use this:

SELECT * FROM users WHERE firstname || surname LIKE 'LINA TA%'

This works I tried.

Answer
Date:
Correct:No

thank you it works.

Your Answer

Review Your Answer