SELECT DISTINCT a.code,b.name,b.Specification,b.Unit FROM Stock_Info b LEFT JOIN IO_Storage_Stock a ON a.Code=b.Code 同样的数据和表结构在mysql用了8秒,在sqlserver用了一秒不到求大神指导!
贴出 explain SELECT DISTINCT a.code,b.name,b.Specification,b.Unit FROM Stock_Info b LEFT JOIN IO_Storage_Stock a ON a.Code=b.Code; show index from Stock_Info ; show index from IO_Storage_Stock ;以供分析
explain SELECT DISTINCT a.code,b.name,b.Specification,b.Unit FROM Stock_Info b LEFT JOIN IO_Storage_Stock a ON a.Code=b.Code;
show index from Stock_Info ;
show index from IO_Storage_Stock ;以供分析