Dennis Dubbeldeman
Dennis Dubbeldeman

Reputation: 11

Creating a search bar in retool with SQL and JavaScript with separated words

I am trying to create a searchbar in retool with SQL and JavaScript. The problem I have is that it needs to search multiple words separately.

The code I have:

select * from prijslijst_nieuw where productnaam ilike {{'%' + textInput4.value + '%'}}

This works, but only on exact matches. For example: Grenen B Ruw 70%Pefc 25x150x3900

If I search 'Grenen B' it will show. But if I search for 'Grenen Ruw' it won't show.

Upvotes: 1

Views: 1035

Answers (1)

fuziion_dev
fuziion_dev

Reputation: 1701

The following SQL query will give you your desired result.

SELECT * FROM `prijslijst_nieuw` WHERE `productnaam` LIKE {{'%' + textInput4.value + '%'}}

Upvotes: 0

Related Questions