lundi 4 janvier 2016

SQL: cut a field, then search

I would like to perform a "on the fly" modification of a field of a sqlite database, before doing a SELECT statement.

The field is called 'topic_simple', and it contains some text. Somewhere in the text, there is a kind of separator I included: 4 spaces: " ".

Here is one of my typical SELECT statement:

SELECT * FROM papers WHERE (topic_simple LIKE '% 3D print%')

I would like something like that:

SELECT * FROM papers WHERE ((topic_simple_before_4_spaces) LIKE '% 3D print%')

I DO NOT WANT to modify topic_simple in the database, I just want to make a select statement on a substring of this field.

How can I do that ?

Aucun commentaire:

Enregistrer un commentaire