gpt4 book ai didi

联系人的 Mysql 语法错误

转载 作者:太空宇宙 更新时间:2023-11-03 10:22:52 25 4
gpt4 key购买 nike

嘿伙计们,出于某种原因,我的 CONCATS 出现语法错误,这很奇怪,因为它几乎是从另一个复制/粘贴的我使用 CONCATS 的查询之一可以完美运行吗?

这是错误的查询

SELECT 
brand,
case_count AS case,
variety,
style,
grower_lot AS lot,
pack_date AS date,
CONCAT(berry_size1, "-", berry_size2, "/", berry_size3, "-", berry_size4) AS size,
CONCAT(color1, "-", color2) AS color,
CONCAT(stem1, "-", stem2, "-", stem3) AS stem_cndt,
CONCAT(bunch_count1, "-", bunch_count2, "-", bunch_count3) AS bnch_cnt,
CONCAT(shatter1, "-", shatter2) AS shatter,
CONCAT(splits1, "-", splits2) AS split,
CONCAT(decay_count1, "-", decay_count2) AS decay,
CONCAT(wet_sticky1, "-", wet_sticky2) AS wet_sticky,
overall_quality AS quality,
CONCAT(sugar_brix1, "-", sugar_brix2) brix,
overall_condition AS condition,
rating,
inspector AS insp,
comments
FROM `lot`

#1064 - 您的 SQL 语法有误;查看与您的 MySQL 服务器版本对应的手册,了解在第 3 行的 'case, variety, style, grower_lot AS lot, pack_date AS date, ' 附近使用的正确语法

这是一个似乎有效的

SELECT
shipper,
po,
commodity as comm,
count,
size,
label,
variety,
pack_date AS date,
grower_lot AS lot,
CONCAT(color1, "-", color2) AS color,
CONCAT(sizing1, "-", sizing2, " / ", "sizing3", "-", sizing4 ) AS size,
CONCAT(firmness1, "-", firmness2) AS firmness,
CONCAT(scars_count1, "-", scars_count2) AS scars,
CONCAT(bruise_count2, "-", bruise_count2) AS bruise,
CONCAT(decay_count1, "-", decay_count2) AS decay_cnt,
CONCAT(sugar_brix1, "-", sugar_brix2) brix,
rating,
inspector AS insp,
comments
FROM `berries`

最佳答案

CONCAT 本身不是问题,但是 case 是 MySQL 中的保留字,需要反引号转义。

关于联系人的 Mysql 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9521376/

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