在SqlServer里的一个数据库里有三个表, A, B , C 表结构字段都一样的!
我怎样实现查询这三个表的数据在同一个DBGrid里显示!!
SELECT A.*, B.*
FROM A, B
这样查的结果不对, 有六万多数据, 我本来两个变加起来才有一两千数据??
表都没有关联关系!
我怎样实现查询这三个表的数据在同一个DBGrid里显示!!
SELECT A.*, B.*
FROM A, B
这样查的结果不对, 有六万多数据, 我本来两个变加起来才有一两千数据??
表都没有关联关系!
union all
select * from B
union all
select * from C
union all
SELECT * FROM B
union all
SELECT * FROM C
FROM A, B
where a.id=b.id
and a.*=b.*
union all
select * from B
union all
select * from C
视图里面不可以用
select * from A
union all
select * from B
union all
select * from C提示
查询设计器不支持 UNION SQL 构造
from A
union all
select *
from B
union all
select *
from C
create table B(name int)
create table C(name int)
gocreate view tt as
select * from A
union all
select * from B
union all
select * from C
goselect * from tt
drop view tt
drop table A
drop table B
drop table C
--没问题阿.
union
select * from b
union
select * from c
怎么给分啊、?在问一下,
视图里面不可以用
select * from A
union all
select * from B
union all
select * from C提示
查询设计器不支持 UNION SQL 构造
select * from
(select * from A
union all
select * from B
union all
select * from C) dd这样看下