gpt4 book ai didi

mysql - 这个mysql全文查询有什么问题?

转载 作者:行者123 更新时间:2023-11-29 06:47:51 25 4
gpt4 key购买 nike

(SELECT COUNT(  `ad_general`.`id` ) as no
FROM (`ad_general`)
WHERE MATCH (title, body) AGAINST (' +stack* 'IN BOOLEAN MODE) AND `user` = '1')
) AS count

这个查询给我这个错误:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use

near 'AS count' at line 17

但是这个正如我预期的那样工作。

SELECT COUNT(  `ad_general`.`id` ) as count
FROM (`ad_general`)
WHERE MATCH (title, body) AGAINST (' +stack* 'IN BOOLEAN MODE) AND `user` = '1')

第一个版本有什么问题?我需要它像第一个一样工作。

最佳答案

您不能这样命名查询。您可以通过将 select 放在前面来解决此问题:

select (SELECT COUNT(  `ad_general`.`id` ) as no
FROM (`ad_general`)
WHERE MATCH (title, body) AGAINST (' +stack* 'IN BOOLEAN MODE) AND `user` = '1')
) AS count

或者你可以这样做:

SELECT COUNT(  `ad_general`.`id` ) as `count`
FROM (`ad_general`)
WHERE MATCH (title, body) AGAINST (' +stack* 'IN BOOLEAN MODE) AND `user` = '1')

关于mysql - 这个mysql全文查询有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17518356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com