34,593
社区成员
发帖
与我相关
我的任务
分享
---result
/*
col1 col2 col3 col4
1 2 a a1
2 3 a a2
*/
--try
create table tb(col1 int,col2 int,col3 varchar(10),col4 varchar(10),col5 varchar(10),col6 varchar(10))
insert into tb select 1,2,'a','a1','b','b1' union all select 2,3,'c','c1','a','a2'
select col1,col2,col3,col4 from tb where col3 = 'a'
union all
select col1,col2,col5,col6 from tb where col5='a'
drop table tb
select 字段1,字段2,字段3,字段4
from tab
where 字段3 ='a' or 字段5='a'
[code=SQL]select 字段1,字段2,字段3,字段4
from tab
where 字段3 ='a' or 字段5='a'
[/code]
create table tb(col1 int,col2 int,col3 varchar(10),col4 varchar(10),col5 varchar(10),col6 varchar(10))
insert into tb select 1,2,'a','a1','b','b1' union all select 2,3,'c','c1','a','a2'
select col1,col2,col3,col4 from tb where col3 = 'a'
union all
select col1,col2,col5,col6 from tb where col5='a'
create table aa(c1 int,c2 int,c3 varchar(10),c4 varchar(10),c5 varchar(10),c6 varchar(10))
insert into aa select 1, 2, 'a', 'a1', 'b', 'b1'
insert into aa select 2, 3, 'c', 'c1', 'a', 'a2'
select c1,c2,c3,c4 from aa a
where c3='a'
union all
select c1,c2,c5,c6 from aa a
where c5='a'