跨数据库查表:
SELECT *
FROM dbo.drp_SEOrder CROSS JOIN
dbo.drp_SEOrderEntry CROSS JOIN
clicksun_cuye.dbo.SEOrder CROSS JOIN
clicksun_cuye.dbo.SEOrderEntry CROSS JOIN
clicksun_yingxiao.dbo.SEOrder CROSS JOIN
clicksun_yingxiao.dbo.SEOrderEntry
跨数据库比较销售订单:
SELECT dbo.drp_SEOrder.sales_order_code AS DRP_FBillNo,
dbo.drp_SEOrder.Fdate AS Fdate,
clicksun_cuye.dbo.SEOrder.FBillNo AS cuye_FBillNo,
clicksun_yingxiao.dbo.SEOrder.FBillNo AS yingxiao_FBillNo,
dbo.drp_SEOrder.Fqty_all, dbo.drp_SEOrder.Fqty_all_c, dbo.drp_SEOrder.Fcost_all,
dbo.drp_SEOrder.Fcost_all_c, dbo.drp_SEOrderEntry.product_code,
dbo.drp_SEOrderEntry.product_name, dbo.drp_SEOrderEntry.product_spec,
dbo.drp_SEOrderEntry.FQty, dbo.drp_SEOrderEntry.FUnit_name,
dbo.drp_SEOrderEntry.FAllAmount, dbo.drp_SEOrderEntry.FAllAmount_c,
dbo.drp_SEOrderEntry.FAuxTaxPrice, dbo.drp_SEOrderEntry.FAuxTaxPrice_c,
clicksun_cuye.dbo.SEOrderEntry.FQty AS cuye_FQty,
clicksun_cuye.dbo.SEOrderEntry.FAuxTaxPrice AS cuye_FAuxTaxPrice,
clicksun_cuye.dbo.SEOrderEntry.FAllAmount AS cuye_FAllAmount,
clicksun_yingxiao.dbo.SEOrderEntry.FQty AS yingxiao_FQty,
clicksun_yingxiao.dbo.SEOrderEntry.FAuxTaxPrice AS yingxiao_FAuxTaxPrice,
clicksun_yingxiao.dbo.SEOrderEntry.FAllAmount AS yingxiao_FAllAmount,
clicksun_cuye.dbo.SEOrder.FStatus AS cuye_FStatus,
clicksun_cuye.dbo.SEOrder.FCancellation AS cuye_FCancellation,
clicksun_yingxiao.dbo.SEOrder.FStatus AS yingxiao_FStatus,
clicksun_yingxiao.dbo.SEOrder.FCancellation AS yingxiao_FCancellation
FROM clicksun_yingxiao.dbo.SEOrder RIGHT OUTER JOIN
clicksun_cuye.dbo.SEOrder RIGHT OUTER JOIN
dbo.drp_SEOrder LEFT OUTER JOIN
clicksun_cuye.dbo.SEOrderEntry RIGHT OUTER JOIN
dbo.drp_SEOrderEntry ON
clicksun_cuye.dbo.SEOrderEntry.FInterID = dbo.drp_SEOrderEntry.FInterID_c AND
clicksun_cuye.dbo.SEOrderEntry.FEntryID = dbo.drp_SEOrderEntry.FEntryID_c LEFT OUTER
JOIN
clicksun_yingxiao.dbo.SEOrderEntry ON
dbo.drp_SEOrderEntry.FInterID = clicksun_yingxiao.dbo.SEOrderEntry.FInterID AND
dbo.drp_SEOrderEntry.FEntryID = clicksun_yingxiao.dbo.SEOrderEntry.FEntryID ON
dbo.drp_SEOrder.sales_order_code = dbo.drp_SEOrderEntry.sales_order_code ON
clicksun_cuye.dbo.SEOrder.FInterID = dbo.drp_SEOrder.FInterID_c ON
clicksun_yingxiao.dbo.SEOrder.FInterID = dbo.drp_SEOrder.FInterID
WHERE (dbo.drp_SEOrder.status = 1)
该评论在 2011/7/1 11:14:53 编辑过