问题一: SELECT * FROM Table1 UNION SELECT * FROM Table2问题二: SELECT * FROM Table1 WHERE name=1 UNION SELECT * FROM Table2 WHERE name=1
1. select * from ( select * from table1 union all select * from table2 union all select * from table3 )a 2. select * from ( select * from table1 union all select * from table2 union all select * from table3 )a where name=1
在问一下各位,VB中rs.open ""中能用union,join等关键字码??谢谢
select * from 表名1 where 条件1 union select * from 表名2 where 条件2 ...前提,两个表结构必须完全一样,而且不能加order by 使用union关键字就和以前的查询语句一样如果是动态的话,可以把语句构造字符串
SELECT *
FROM Table1
UNION
SELECT *
FROM Table2问题二:
SELECT *
FROM Table1
WHERE name=1
UNION
SELECT *
FROM Table2
WHERE name=1
select * from ( select * from table1
union all
select * from table2
union all
select * from table3
)a
2.
select * from ( select * from table1
union all
select * from table2
union all
select * from table3
)a where name=1
使用union关键字就和以前的查询语句一样如果是动态的话,可以把语句构造字符串