gpt4 book ai didi

mysql 语法错误,无论我更改什么都一样

转载 作者:行者123 更新时间:2023-11-30 22:53:31 24 4
gpt4 key购买 nike

我在选择仓库表中的所有内容并从他们的表中获取客户和用户的名称以及这些名称的 ID 以从仓库表中获取它们时遇到问题,

数据库结构:

table 1: warehouse 
table 2: customer (City, FirstName, LastName)
table 3: user (FirstName, LastName)

$result = mysql_query("SELECT customer.City, customer.FirstName AS customerFName, customer.LastName AS customerLName, user.FirstName AS clientFName, user.LastName AS clientLName, warehouse.*".
"FROM warehouse".
"INNER JOIN customer, user".
"ON warehouse.CustomerID = customer.CustomerID AND warehouse.UserID = user.UserID") or trigger_error(mysql_error());

注意:您的 SQL 语法有误;查看与您的 MySQL 服务器版本对应的手册,了解在 'ON warehouse.CustomerID = customer.CustomerID AND warehouse.UserID = user.UserID' 附近使用的正确语法

最佳答案

像这样更改查询。

$result = mysql_query("SELECT customer.City, customer.FirstName AS customerFName, customer.LastName AS customerLName, user.FirstName AS clientFName, user.LastName AS clientLName, warehouse.* ". 
"FROM warehouse".
" INNER JOIN customer".
" ON warehouse.CustomerID = customer.CustomerID".
" INNER JOIN user ON warehouse.UserID = user.UserID") or trigger_error(mysql_error());

关于mysql 语法错误,无论我更改什么都一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27351785/

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