以下是引用Bin在2013-12-23 11:39:00的发言:没搞懂你结构是怎么样的,推测你是想这样
能否上个例子.
从crm_sale从另外2个表中获得数据
方式一
select * FROM [c2].[dbo].[crm_sale] where sell_date>'2013-01-01' and sell_date<'2013-01-10' order by sell_date
方式二
select crm_sale.sale_id,crm_sale.totalMoney,crm_sale.sale_num,crm_sale.sell_date,stuff_outstock.ref_id,stuff_outstock.out_code,crm_opportunity.from_id from (crm_sale left JOIN crm_opportunity ON crm_sale.opp_id=crm_opportunity.opp_id)
left JOIN stuff_outstock ON crm_sale.sale_id=stuff_outstock.ref_id where sell_date>'2013-01-01' and sell_date<'2013-01-10' order by sell_date
都用left join,方式二是不是和方式获得数据行是一样多的
[此贴子已经被作者于2013-12-23 12:20:02编辑过]