Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Query on Select2+multiple field

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Mr71
Posts: 41
Joined: Thu Sep 30, 2021 10:32 am

Query on Select2+multiple field

Unread post by Mr71 »

I'm using select2 + multiple:
I'll give a simplified example:
- in object select tab: 1|Red|2|green|3|blue.
- field in the table -> 'color' varchar (255)
If in the object (select2 + multiple) I select (red and blue) in the 'color' field of table, ["1","3"] is stored, I think that's a json string!!.
At this point in a query I want to find (for example) all the records that have on this string (in field) the color set to "blue" ("3").
I try with json_extract and json_search statement but it returns me all the records or nothing.
In the real solution I'm actually developing i would like to use the field in an address book to insert some kind of tag and then use the contact based on the tags in specific parts of the database.
What is the mysql query to make this selection?!
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Query on Select2+multiple field

Unread post by kev1n »

Would that work?

Code: Select all

WHERE your_column like '%3%'
Mr71
Posts: 41
Joined: Thu Sep 30, 2021 10:32 am

Re: Query on Select2+multiple field

Unread post by Mr71 »

I made it too hard... :lol:
I had tried but not with the double "%" ...
it works! it works!

Thanks Kevin
Post Reply