select spbm from a where spbm=1 union
select spbm from b where spbm=1 union
select spbm from c where spbm=1 union
select spbm from d where spbm=1 union
select spbm from e where spbm=1 union
select spbm from f where spbm=1 union
select spbm from g where spbm=1
select spbm from b where spbm=1 union
select spbm from c where spbm=1 union
select spbm from d where spbm=1 union
select spbm from e where spbm=1 union
select spbm from f where spbm=1 union
select spbm from g where spbm=1
解决方案 »
- 数据不出来,帮帮忙
- SQL Server 2000 的企业管理器中新建的数据库,为什么在查询管理器中看不到
- 查询的问题,希望各位大虾解答解答
- 问几个关于sqlserver分区的问题
- 问一个弱智的问题:sql 2008怎么添加一个有密码的用户
- 小菜初学SQL,有个小问题关于UPDATE的
- 急!急!急!“由于登陆失败而无法启动服务”是什么错误?
- 连接局域网内sqlserver2005出错,provider:命名管道提供程序,error:26 - 无法打开sqlserver的连接
- 请教多层结构实现模糊查询的方法?
- 如何在存储过程中select 一些数据,同时对返回参数赋值?
- 分析一下这个SQL语句
- 在触发器中调用扩展存储过程一问,多谢各位:)
from(
select count(*) as cont from a where spbm=1 union
select count(*) as cont from b where spbm=1 union
select count(*) as cont from c where spbm=1 union
select count(*) as cont from d where spbm=1 union
select count(*) as cont from e where spbm=1 union
select count(*) as cont from f where spbm=1 union
select count(*) as cont from g where spbm=1
) ta
同意楼上说得.
select count(*) from
(
select * from a where spbm=1 union
select * from b where spbm=1 union
select * from c where spbm=1 union
select * from d where spbm=1 union
select * from e where spbm=1 union
select * from f where spbm=1 union
select * from g where spbm=1
)table
(
select * from a where spbm=1 union
select * from b where spbm=1 union
select * from c where spbm=1 union
select * from d where spbm=1 union
select * from e where spbm=1 union
select * from f where spbm=1 union
select * from g where spbm=1
)table对的
select spbm from a where spbm=1 union all
select spbm from b where spbm=1 union all
select spbm from c where spbm=1 union all
select spbm from d where spbm=1 union all
select spbm from e where spbm=1 union all
select spbm from f where spbm=1 union all
select spbm from g where spbm=1) a)
begin
print '有呀'
end else print '不好意思,沒有'哈哈,上面的可以吧
if exists(select *
from(
select aa=1 from a where spbm=1
union
select aa=1 from b where spbm=1
union
select aa=1 from c where spbm=1
union
select aa=1 from d where spbm=1
union
select aa=1 from e where spbm=1
union
select aa=1 from f where spbm=1
union
select aa=1 from b where spbm=1
)a)
print '有'
else
print '无'