SQL语句中的错误1064

时间:2014-11-28 12:38:08

标签: mysql

我曾尝试运行SQL命令,但收到此错误: #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 ')

SQL语句是

SELECT                                        * , 
     Match(product.title) against (query) + match(product.description) against (query1) +match(product.keyword) against (query2)+match(product.url) against (query2) + (average(review.rating)/100*count(productid))+(100/price)+(site.domainauthority/25)+(10- 
     CASE 
              WHEN lcase(seller.city) = lcase(city) THEN TRUNCATE(( 6371 * acos( cos( radians( 23 ) ) * cos( radians( seller.latitude ) ) * cos( radians( seller.longitude ) - radians(24) ) + sin( radians( 24 ) ) * sin( radians( seller.latitude ) ) ) ),1))
ELSE + 0 
END AS score 
FROM     product, 
         productimages, 
         review, 
         seller, 
         site 
WHERE    distance < 10 
AND      productimage.id=product.id 
AND      product.sellerid =seller.id 
AND      product.siteid-site.id 
AND      productmeta.id = product.id 
AND      review.productid = product.id 
AND      (( 
                       seller.deliverabletype = "international") 
     OR       ( 
                       seller.deliverabletype = "country" 
              AND      seller.country = 'country') 
     OR       ( 
                       seller.deliverabletype = "state" 
              AND      seller.country = 'country') 
     OR 
     OR       ( 
                       seller.deliverabletype = "city" 
              AND      seller.country = 'city')) 
GROUP BY product.id mysql sql-server

1 个答案:

答案 0 :(得分:0)

查询格式不正确。其中一个右括号应该在最后。

试试这个。     截短(                     (6371 * acos(                                     cos(弧度(23))* cos(弧度(seller.latitude))*                                     cos(弧度(seller.longitude) - 弧度(24))+                                     sin(弧度(24))* sin(弧度(seller.latitude))                                 )                     ),1)

ELSE + 0 END)AS得分