mysql - 全外连接SQL错误jj

标签 mysql sql

考虑:

Select Dash_Bill_ID As 'رقم الفاتورة',
       c2.Customer_Name As 'العميل',
       c1.Customer_Name As 'المهندس/المقاول',
       delegate.Delegate_Name As 'المندوب',
       Total_CostBD As 'الاجمالي قبل الخصم',
       Total_CostAD As 'الاجمالي بعد الخصم',
       Bill_Date As 'التاريخ',
       Type_Buy As 'طريقة الدفع',
       Initial_Value As 'العربون',
       bank.Bank_Name As 'الخزنة'
From   customer_bill
Full Outer Join customer As c1
    On c1.Customer_ID = customer_bill.Customer_ID
Full Outer Join customer As c2
    On c2.Customer_ID = customer_bill.Client_ID
Full Outer Join delegate
    On delegate.Delegate_ID = customer_bill.Delegate_ID
Full Outer Join bank
    On bank.Bank_ID = customer_bill.Bank_ID
Where  Dash_Bill_ID = 24;

我收到错误:

[Err] 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 'outer join customer as c1 on c1.Customer_ID=customer_bill.Customer_ID full outer' at line 1

最佳答案

MySQL 不支持 FULL JOIN,这是您遇到的具体问题。

但是,完全不可能需要 FULL JOIN。在结构良好的数据库中,几乎不需要完全连接。假设 customer_bill 中所有引用的字段均非 NULL,则 INNER JOIN 应该没问题。或者,您可能需要LEFT JOIN

关于mysql - 全外连接SQL错误jj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46470530/

相关文章:

mysql - 计数排除最大和最小出现次数

sql - 列数 每个过程返回 T-Sql

SQL 查询对表 X 的所有字段动态 COUNT(FIELD)

php - 用户上次登录/浏览网站的时间

mysql - 具有多个连接的 MySQL 查询执行计划效率低下

MySQL DateTime 选择间隔

SQL - 对公共(public)表表达式进行排序

javascript - 将数据上传到数据库而不停止站点的加载

php - 在页面之间传递数据?

php - 需要帮助使 sql 查询按列比较数据