Reputation: 151
I have this sql command: select name from criminals where name || surname like '%SH%' order by id;
The problem is that my results show also the name "LambroS" "Hitiris" just because the last name letter and the first surname letter form "SH". How can I fix that? I want to show results if either one of them CONTAINS these letters.
Upvotes: 0
Views: 97
Reputation: 80
You can also try to use OR:
select name from criminals where name like '%SH%' OR surname like '%SH%'
Upvotes: 2
Reputation: 4137
Try this:
SELECT NAME
FROM CRIMINALS
WHERE NAME
|| ' '
|| SURNAME LIKE '%SH%'
ORDER BY ID;
Upvotes: 0