select a.ID,c.xm as 姓名,count(a.ID) as 次数,b.nl as 年龄, case c.xb when 1 then '男' else '女' end as 性别 from REPORT as a left join tj.BS_tjxt.DBO.TJ_TJDJB as b on a.ID=b.TJBH left join tj.BS_tjxt.DBO.TJ_TJDAB as c on b.DABH=c.DABH where a.TYPE='11' and a.REPORT_STATE='206' group by ID,c.xm,b.nl,c.xb
开始我以为是sql语句的问题,但是我后来在本机还原了一个备份测试,(本机是xp,服务器windows server 2008 R2,sql都是sqlserver2008 R2),同样的方式建立链接服务器,但是执行一样的sql只要4秒,
exec sp_addlinkedserver 'tj','','SQLOLEDB','10.90.90.253' exec sp_addlinkedsrvlogin 'tj','false',null,'sa','123' go