gpt4 book ai didi

mysql - 查询表达式中的语法错误(缺少运算符) sri.invoiceNo = sri.invoiceNo INNER JOIN Staff s oN s.Staffid = sr.userld

转载 作者:行者123 更新时间:2023-11-29 07:37:02 24 4
gpt4 key购买 nike

"SELECT SalesReturnId, ReturnDate, sr.InvoiceNo, (lastname & ', ' & firstname & ', ' &  MI) as StaffName, TotalAmount, SUM(sri.Quantity) as TotalQuantity FROM SalesReturn sr INNER JOIN SalesReturnItem sri ON sr.InvoiceNo = sri.InvoiceNo INNER JOIN Staff s ON s.StaffId = sr.userID WHERE ReturnDate  BETWEEN '" + startDate.ToString("yyyy-MM-dd") + "' AND '" + endDate.ToString("yyyy-MM-dd") + "' AND sr.InvoiceNo LIKE '%" + txtName.Text + "%' GROUP BY sr.InvoiceNo ORDER BY ReturnDate, sr.InvoiceNo DESC";

当我运行该查询时,我不断收到此错误:

syntax error (missing operator) in query expression sri.invoiceNo = sri.invoiceNo INNER JOIN Staff s oN s.Staffid = sr.userld

最佳答案

在 Access 中,当您有多个联接时需要括号:

SELECT SalesReturnId, ReturnDate, sr.InvoiceNo, 
(lastname & ', ' & firstname & ', ' & MI) as StaffName,
TotalAmount, SUM(sri.Quantity) as TotalQuantity
FROM (SalesReturn sr
INNER JOIN SalesReturnItem sri ON sr.InvoiceNo = sri.InvoiceNo )
INNER JOIN Staff s ON s.StaffId = sr.userID
WHERE ReturnDate BETWEEN '" + startDate.ToString("yyyy-MM-dd") + "' AND '" + endDate.ToString("yyyy-MM-dd") + "'
AND sr.InvoiceNo LIKE '%" + txtName.Text + "%'
GROUP BY sr.InvoiceNo
ORDER BY ReturnDate, sr.InvoiceNo DESC;

关于mysql - 查询表达式中的语法错误(缺少运算符) sri.invoiceNo = sri.invoiceNo INNER JOIN Staff s oN s.Staffid = sr.userld,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48319537/

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