【发布时间】:2018-07-05 22:13:22
【问题描述】:
我正在尝试在 json 文件中创建以下 sql 语句:
SELECT user_id
FROM users_to_users
WHERE (user_id, contact_user_id, contact_blocked) IN ?
我尝试为 ?值,但返回错误。 json有没有办法为上述sql语句中的插入传递一个元组数组?
【问题讨论】:
我正在尝试在 json 文件中创建以下 sql 语句:
SELECT user_id
FROM users_to_users
WHERE (user_id, contact_user_id, contact_blocked) IN ?
我尝试为 ?值,但返回错误。 json有没有办法为上述sql语句中的插入传递一个元组数组?
【问题讨论】:
简单例子:-
SELECT t.*
FROM YOUR_TABLE t
WHERE FIND_IN_SET(3, t.ids) > 0
-- all books with tags starting 'Java':
SELECT * FROM `book`
WHERE JSON_SEARCH(tags, 'one', 'Java%') IS NOT NULL;
Check This Reference which uses JSON To see the whole possible Solutions
【讨论】: