当前位置: 代码迷 >> Sql Server >> 这二句话效率区别大么
  详细解决方案

这二句话效率区别大么

热度:70   发布时间:2016-04-24 09:54:41.0
这2句话效率区别大么
 select id,(select name from stock where id=a.stockid) as stock, 
(select name from stack where id=a.stackid) as stack, 
(select name from product where id=a.productid) as product,amount 
from A as a 
 

select a.id, b.stock, c.stack, d.product, a.amount 
from 主表 as a inner join stock as b on a.stockid = b.id 
inner join stack as c on a.stackid = c.id 
inner join product d on a.productid = d.id 
.
说真的,2个办法都在用,一直不知道到底效率如何,请各位指点。


------解决思路----------------------
建议你小数据量就用上面的,大数据量就用下面的!!!!!
------解决思路----------------------
建议用第二种
  相关解决方案