Reputation: 1494
I have a table with First Name, Last Name and Contact Number.
If user enters kar
, then I want a full list with results containing kar
in the First name or Last Name.
Upvotes: 3
Views: 64
Reputation: 15450
This assumes that kar
is a portion of a name, if it is the full name, then do first_name = 'kar'
SELECT first_name, last_name, number
FROM your_phone_book
WHERE first_name LIKE '%kar%'
OR last_name LIKE '%kar%'
Upvotes: 1
Reputation: 20838
It's really rather simple:
SELECT * FROM directory
WHERE firstname LIKE '%kar%'
OR lastname LIKE '%kar%';
Upvotes: 1