0

Consider:

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;

I get an error:

[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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131

1 Answers1

1

MySQL does not support FULL JOIN which is the specific problem you are experiencing.

However, it is highly unlikely that a FULL JOIN is even desired. In a well-constructed databases, full joins are almost never needed. Assuming that all referenced fields are non-NULL in customer_bill, the INNER JOIN should be fine. Alternatively, you might want a LEFT JOIN.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786