SQL Join导致多个重复条目

时间:2016-12-02 14:37:13

标签: sql left-join zoho

我有麻烦想弄清楚如何从第一张桌子摆脱欺骗。请在此处查看突出显示的行,以供参考enter image description here

这是我输入的格式

SELECT
     "Classes.Class Name" AS Customer,
     "Customers.Customer Name" as docket,
     "Items.Item Name" as EST_Item,
     Quantity as EST_Qty,
     "Unit Price" as EST_UnitPrice,
     "Query_Bill Line items"."Items.Item Name" as BILL_Item,
     "Query_Bill Line items"."Quantity" as Bill_Qty,
     "Query_Bill Line items"."Unit Price" as Bill_UnitPrice
FROM  "Query_Estimate Line Items" LEFT JOIN "Query_Bill Line Items" ON "Query_Estimate Line Items"."cUSTOMERS.cUSTOMER NAME"  = "Query_Bill Line Items"."CUSTOMERS.CUSTOMER NAME"
 AND    "Query_Estimate Line Items"."iTEMS.ITEM NAME"  = "Query_Bill Line Items"."ITEMS.ITEM NAME"  

抱歉超长列名!从Table1"" Query_Estimate Line Items"< 34;

中删除欺骗,我错过了什么?

谢谢

1 个答案:

答案 0 :(得分:0)

要减少行数,您需要按某些内容(例如Customer,Docket,EST_Item)进行分组,并聚合未分组的列(例如Bill_Qty或Unit_Price)。你知道如何使用group by吗?