Select ...
from ht_wyy b
left join jf_shb a on b.wy_level=a.azwzjb
left join jf_db c on ...
left join jf_mq d on ...
from ht_wyy b
left join jf_shb a on b.wy_level=a.azwzjb
left join jf_db c on ...
left join jf_mq d on ...
解决方案 »
- SQL sever中要删除两个相关联的表该如何进行级联删除
- 请教一SQL语句!有点难度!
- 截取字符串(substring函数实现不了预期的效果)
- 局域网里的SQL数据库,怎么让所有人都能用?
- ACCESS里写的自定义函数,哪位帮我转到SQL自定义函数里呢?
- 有关DATEDIFF用法(急)
- sql用references时为啥老提示语法错误
- 怎样将sql server数据库保存成excel表
- 我在sql中建立了全文检索,为什么不好使?
- 请问,文件的“自动增长设置”是干什么用的?是否都要设置自动增长?增长多少才合适?有什么衡量标准吗?谢谢!
- 变量与结果集
- 錯誤信息:'Cannot resolve collation conflict for equal to operation.'
as select b.ht_num,wyname=
case when b.wy_level=1 then (select dq_name from wydq where dq_id=b.wy_wzid)
when b.wy_level=2 then (select wy_name from wymc where wy_id=b.wy_wzid)
when b.wy_level=3 then (select wyd_name from wyd where wyd_id=b.wy_wzid)
when b.wy_level=4 then (select yj_fl from wy_yjfl where yj_id=b.wy_wzid)
when b.wy_level=5 then (select ej_fl from wy_ejfl where ej_id=b.wy_wzid)
end,b.wy_level,b.wy_wzid,a.shbbh,a.sbbh,c.dbbh,c.sbbh,d.mqb_bh ,d.sbbh
from ht_wyy b
left join jf_shb a on b.wy_level=a.azwzjb and b.wy_wzid=a.azwzid
left join jf_db c on b.wy_level=c.azwzjb and b.wy_wzid=c.azwzid
left join jf_mq d on b.wy_level=d.azwzjb and b.wy_wzid=d.azwzid
union
select b.ht_num,wyname=
case when b.wy_level=1 then (select dq_name from wydq where dq_id=b.wy_wzid)
when b.wy_level=2 then (select wy_name from wymc where wy_id=b.wy_wzid)
when b.wy_level=3 then (select wyd_name from wyd where wyd_id=b.wy_wzid)
when b.wy_level=4 then (select yj_fl from wy_yjfl where yj_id=b.wy_wzid)
when b.wy_level=5 then (select ej_fl from wy_ejfl where ej_id=b.wy_wzid)
end,b.wy_level,b.wy_wzid,a.shbbh,a.sbbh,c.dbbh,c.sbbh,d.mqb_bh ,d.sbbh
from yzht_wy b
left join jf_shb a on b.wy_level=a.azwzjb and b.wy_wzid=a.azwzid
left join jf_db c on b.wy_level=c.azwzjb and b.wy_wzid=c.azwzid
left join jf_mq d on b.wy_level=d.azwzjb and b.wy_wzid=d.azwzid
-----------------
服务器: 消息 8156,级别 16,状态 1,过程 wy,行 3
多次为 'wy' 指定了列 'sbbh'。
-----------
这是怎么回事?
列名相同要指定别名
如
end,b.wy_level,b.wy_wzid,a.shbbh as a,a.sbbh as b,c.dbbh as c,c.sbbh as d,d.mqb_bh ,d.sbbh
from ht_wyy b
left join jf_shb a on b.wy_level=a.azwzjb
left join jf_db c on ...
left join jf_mq d on ...