不建视图
选出table1中id为1 或 table2中id为1 table3中id为1 或 table3中id为1 的所有记录
选出table1中id为1 或 table2中id为1 table3中id为1 或 table3中id为1 的所有记录
解决方案 »
- 字段 取 最大值。
- 在线等结果,新手求语句
- SQL2008
- 请教数据库互访使用代理的问题!
- 高手们,这个sql循环该怎么写?
- 【SQL Server 2005】telnet localhost 1433 无法打开主机的连接。在端口 1433:连接失败
- 多表之间的连接,什么情况下数据会出现重复的情况呢?
- 紧急!一个update语句能否同时更新多个表?
- 有密码保护的access意外退出,结果下一次进入时怎么也打不开,怎么打开?或怎么取消密码保护?
- 小白求大神帮帮优化语句!
- 性能问题,我的统计作业要10个小时才能执行完(包括很多步),上次移到新的服务器上时,才4个小时就搞定了,各位指点下为什么。。。
- 一个查询语句的问题
union all
select * from table2 where id=1
union all
select * from table3 where id=1
create view test_view
as
select * from table1 where id=1
union all
select * from table2 where id=1
union all
select * from table3 where id=1执行!
select * from test_view
-------------------------
select * from table1 where id=1
union all
select * from table2 where id=1
union all
select * from table3 where id=1
-------------------------
不对呀,报错服务器: 消息 205,级别 16,状态 1,行 1
包含 UNION 运算符的 SQL 语句中的所有查询都必须在目标列表中具有相同数目的表达式。
是不是写错了,两个都是table3
不建视图
选出table1中id为1 或 table2中id为1 table3中id为1 或 table4中id为1 的所有记录我各个表里字段数不一