A
A
Artem2019-05-16 20:46:45
PostgreSQL
Artem, 2019-05-16 20:46:45

How to get records whose json field includes at least one value from the passed ones?

As from the view table:

id|name|json_data
1|vasya|{"tags": ["a", "b", "c"]}
2|lena|{"tags":["d", "e", "f"]}
3|dima|{"tags": ["x", "y", "z"]}

Get sample:
id|name|json_data
1|vasya|{"tags": ["a", "b", "c"]}
3|dima|{"tags": ["x", "y", "z"]}

SELECT * FROM table WHERE "table"."json_data" ??? '{"tags":["a", "b", "c", "y"]}';

That is, all intersections with at least one element of the passed array.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
VicTHOR, 2019-05-16
@Cruper

SELECT * FROM `table` WHERE CONTAINS(`json_data`, '"*a*" OR "*b*" OR "*c*" OR "*y*"')

K
Konstantin Frank, 2017-05-10
@etozhematvekat

If I understand correctly, then the DLS-2500U works for you as a DHCP server. So you need to configure Keenetic Omni as an access point, and it must receive the Internet via IPoE (direct connection). One of the first articles on Google is rudevice.ru/zyxel/zyxel-keenetic-omni. The setting is covered in "NAT when automatically obtaining an IP address (DHCP)".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question