Roger Federer Roger Federer - 1 year ago 83
SQL Question

How do I make a SQL query to select all items that contain a certain sub-string?

For example I have a table named "location" and a column "name". I want all names that contain the sub-string "abe" for example. I am using postegresql.

Answer Source

As you mention postgresql in your tag you should have a look at the PostgreSQL documentation.

There is a topic about pattern matching

One solution for your query would be:

select *
from location
where name like '%abe%'

LIKE is also explained on w3schools.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download