0

AS当我删除该子句时,此 SQL 查询运行良好。

$query = "SELECT bd_brushname FROM tbl_brushdescription WHERE MATCH(bd_brushname, bd_brushdescription) AGAINST ('brushes' IN BOOLEAN MODE) AS rank";
    $sqlquery = mysql_query($query);
    if($sqlquery === FALSE){
        die(mysql_error()); 
    }

当我使用时AS,它说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 rank' at line 1

有人可以告诉我为什么它不起作用吗?

4

2 回答 2

0

别名应放在您选择的列上,以:

  • 在您的输出中重命名它们
  • order byorhaving子句中使用别名

资源

了解您的要求,您在这里使用别名作为条件,有什么意义?

你试图做什么?

于 2013-06-12T15:24:41.237 回答
0

更改“AS等级”的位置

$query = "SELECT bd_brushname AS rank FROM tbl_brushdescription WHERE MATCH(bd_brushname, bd_brushdescription) AGAINST ('brushes' IN BOOLEAN MODE)";
    $sqlquery = mysql_query($query);
    if($sqlquery === FALSE){
        die(mysql_error()); 
    }
于 2013-06-12T15:32:00.627 回答