我有4个表a,b,c,d
a
machineid
a1
b
routinid
b1
c
machineid
routinid
c1
d
machineid
routinid
d1如何实现如下效果select c1.*,d.d1,a.a1.b.b1 from c left join a on a.machineid=c.machineid
left join b.routinid=c.routinid left join d on (c.routinid=d.routinid and d.machineid=c.machineid)
好像left join不支持on (c.routinid=d.routinid and d.machineid=c.machineid) 这种语句
如果想实现类似效果怎么做呢?
a
machineid
a1
b
routinid
b1
c
machineid
routinid
c1
d
machineid
routinid
d1如何实现如下效果select c1.*,d.d1,a.a1.b.b1 from c left join a on a.machineid=c.machineid
left join b.routinid=c.routinid left join d on (c.routinid=d.routinid and d.machineid=c.machineid)
好像left join不支持on (c.routinid=d.routinid and d.machineid=c.machineid) 这种语句
如果想实现类似效果怎么做呢?
解决方案 »
- 请问,在视图中该怎么用CASE函数?
- DELETE 刪除恢復
- 如何实现年龄的自动计算?
- 关于分组的语句如何写
- 如何在企业管理器里建立一个SQL SERVER组项目?
- 這麼長SQL看著都頭暈了,大家幫分析一下,謝謝了
- 请教一个数据设计的问题
- SSIS package job erro
- 做过报表的朋友请进先给100,回答后再加,决不失言在线等!
- 数据库连线问题?**<使用者sa登入失敗,原因末結合受信任SQL server连线>**???
- 能否使用Sql server 2005的作业调用windows下的exe程序?在集群中也能行吗?
- sqlserver 服务器报,IUSR_user 用户名未知或密码错误,IUSR_user是web服务器用户
left join b.routinid=c.routinid left join d on (c.routinid=d.routinid and d.machineid=c.machineid)
好像left join不支持on (c.routinid=d.routinid and d.machineid=c.machineid)
这里错了.改成
left join b on b.routinid=c.routinid left join
select c.*,d.d1,a.a1,b.b1 from c left join a on a.machineid=c.machineid
left join B ON b.routinid=c.routinid left join d on (c.routinid=d.routinid and d.machineid=c.machineid)
我想到办法解决这个问题了,谁若能告诉我sql server支持 left join on ( a=b and c=d) 这种写法。我就把分给谁