When I execute this query with MATCH AGAINST using MySql (see Query 1st) the issue in this query they has generated an error like this (see error) or when I execute the same query with = they executed normally(see Query 2nd).
当我使用与使用MySql匹配的查询(请参阅查询1)执行此查询时,查询中出现了这样的错误(请参阅错误),或者当我使用=执行相同的查询时(请参阅查询2)。
My question is what am I doing wrong with against statement?
我的问题是我做错了什么?
Query 1st
查询1
SELECT (SELECT COUNT(up.`user_id`)
FROM `users_post` up WHERE MATCH (up.`user_id`) AGAINST (uf.`user_id`))
AS user_count
FROM `users` uf
Error
错误
enter code hereError Code : 1210
Incorrect arguments to AGAINST
(0 ms taken)
Update
更新
Query 2nd
查询2
SELECT
(SELECT COUNT(up.`user_id`)
FROM `users_post` up WHERE up.`user_id` = uf.`user_id`)
AS user_count
FROM `users` uf
1 个解决方案
#1
3
The problem is that the argument for AGAINST
must be a literal string, for example 'Fred'
. It is not allowed to use a column name like uf.user_id
.
问题是,反对的参数必须是一个字符串,例如“Fred”。不允许使用像uf.user_id这样的列名。
MATCH (up.`user_id`) AGAINST (uf.`user_id`)
-- ^^^^^^^^^^^^ not allowed!
From the documentation:
从文档:
The search string must be a literal string, not a variable or a column name.
搜索字符串必须是文字字符串,而不是变量或列名。
You probably need to use LIKE
instead of MATCH
, though you should note that it will be much slower.
您可能需要使用LIKE而不是MATCH,尽管您应该注意它会慢得多。
#1
3
The problem is that the argument for AGAINST
must be a literal string, for example 'Fred'
. It is not allowed to use a column name like uf.user_id
.
问题是,反对的参数必须是一个字符串,例如“Fred”。不允许使用像uf.user_id这样的列名。
MATCH (up.`user_id`) AGAINST (uf.`user_id`)
-- ^^^^^^^^^^^^ not allowed!
From the documentation:
从文档:
The search string must be a literal string, not a variable or a column name.
搜索字符串必须是文字字符串,而不是变量或列名。
You probably need to use LIKE
instead of MATCH
, though you should note that it will be much slower.
您可能需要使用LIKE而不是MATCH,尽管您应该注意它会慢得多。