select Products.SKU, Products.MPN, Products.Manufacturer, dpi.DLRcost, dpi.msrp, dpi.Quantity, pu.UnitofMeasure, pu.ActualWeight, pu.ShipWeight, pu.Length, pu.Width, pu.Height
from
(select PartNumber as SKU, MPN, Manufacturer
from ActiveProducts
union select SKU, MFP, Brand
from ActiveItems
union select SKU, mfr_part_number, manufacturer
from AllProductsCombined
) as Products, DealerPriceInventory dpi, PriceUpdate pu
where Products.sku=dpi.sku AND dpi.sku=pu.SKU
我想将上述查询的结果与另一个表连接起来,因为并非所有skus都在右表中。无论如何在没有内部加入本声明中的所有表格的情况下完成此操作?
答案 0 :(得分:1)
"新" ANSII语法已于1992年推出,因此您可以在查询中自由使用它。
getDate(date){
date = date.split('\/');
date = date[2] + '-' + date[0] + '-' + date[1];
let re = /\//gi;
date = date.replace(re, "-");
return date;
}
答案 1 :(得分:0)
这就是我要去的方式:
with Products as (select PartNumber as SKU, MPN, Manufacturer
from ActiveProducts
union select SKU, MFP, Brand
from ActiveItems
union select SKU, mfr_part_number, manufacturer
from AllProductsCombined),
NewTable as (select NewColumn,Sku1 from NewTable)
select Products.SKU, Products.MPN, Products.Manufacturer, dpi.DLRcost,
dpi.msrp, dpi.Quantity, pu.UnitofMeasure, pu.ActualWeight, pu.ShipWeight,
pu.Length, pu.Width, pu.Height, NewTable.NewColumn from Products
left join DealerPriceInventory dpi on Products.sku=dpi.sku
left join PriceUpdate pu on dpi.sku=pu.SKU
left join NewTable on Products.sku=NewTable.sku1
....