我是一名英语专业学生,在我非常基本的SQL Stuff中磕磕绊绊。我已经得到了两个语句来返回我需要的结果(都来自同一个表):
select *
from Table1
where Column1 = 'Examplel' and UniqueID is not null
order by UniqueID2
(返回2000行)
select *
from Table1
where Column1 = 'Examplel'
and ColumnDATE between '2008-02-12 00:00:00.000' and '2013-08-15 00:00:00.000'
order by UniqueID2
(2001年回归)
我需要找到一条差异线,优先不滚动并比较两个结果中的所有线。救命?
将此全部作为一个语句运行:
select * from Table1 where Column1 = 'Examplel' and UniqueID is not null order by UniqueID2
except
select * from Table1 where Column1 = 'Examplel' and ColumnDATE between '2008-02-12 00:00:00.000' and '2013-08-15 00:00:00.000' order by UniqueID2
然后反过来:
select * from Table1 where Column1 = 'Examplel' and ColumnDATE between '2008-02-12 00:00:00.000' and '2013-08-15 00:00:00.000' order by UniqueID2
except
select * from Table1 where Column1 = 'Examplel' and UniqueID is not null order by UniqueID2
select *
from Table1
where Column1 = 'Examplel'
and ColumnDATE between '2008-02-12 00:00:00.000' and '2013-08-15 00:00:00.000
and UniqueID is null
order by UniqueID2