Where clause using part of a string

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Where clause using part of a string

Post by AlessioForconi » Thu Mar 24, 2016 12:45 pm

Hello,

having this data
abcd efgh hilmne
abcd efgh hilmne
abcd efgh hilmne
abcd efgh hilmno
abcd efgh hilmno
abcd efgh hilmno
abcd efgh hilmna
abcd efgh hilmna
...
...
how can I build a query that extracts all records with hilmne?

Thanks

Klaus
Posts: 13865
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Where clause using part of a string

Post by Klaus » Thu Mar 24, 2016 3:00 pm

Buongiorno Alessio,

is one line one database field in one record in your example data?
Or a "set" of (several) fields in one record?

In any case you will be need to use: LIKE %...
Something like this if one line is one field in your example:
...
SELECT * from YOURTABLE WHERE YOUR_FIELD LIKE '%hilmne%'
...
Check this for more info:
http://www.w3schools.com/sql/default.asp


Best

Klaus

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Where clause using part of a string

Post by AlessioForconi » Thu Mar 24, 2016 3:51 pm

Guten tag Klaus

you're right, I did not specify that the data on which I intend to run the query are found every line in the same field of the database. I try with% like.

Thank you

Post Reply

Return to “Databases”