日期:2014-05-19  浏览次数:20451 次

如何提取不存在于表中的数据?
比如我现在有   a,b,c,d,e   三个数据。

现在数据库中只有   a,b

如何可以用   SQL   语句查询出结果为   c,d,e

------解决方案--------------------
说得详细点!!
------解决方案--------------------
select col1,col2, 'c ' as col3, 'd ' as col4 from tb
------解决方案--------------------
没看懂楼主的问题
------解决方案--------------------
select a,b,null as c,null as d,null as e from table1
------解决方案--------------------
create table tba(id varchar(10))
insert into tba(id) values( 'a ')
insert into tba(id) values( 'b ')
insert into tba(id) values( 'c ')
insert into tba(id) values( 'd ')
insert into tba(id) values( 'e ')

create table tbb(id varchar(10))
insert into tbb(id) values( 'a ')
insert into tbb(id) values( 'b ')

select * from tba where id not in (select id from tbb)
------解决方案--------------------
不明白~
------解决方案--------------------
a,b,c,d,e 三个数据。

----------
怎么会是三个数据呢?