You are here: Re: UNION / INTERSECT / EXCEPT in SQL Server 2000 « MsSQL Server « IT news, forums, messages
Re: UNION / INTERSECT / EXCEPT in SQL Server 2000

Posted by Ed Murphy on 09/21/06 13:20

James Foreman wrote:

> In DB2, if I have two sets of data and I want to exclude the second set
> from the first, I can do:
>
> SELECT col1, col2, col3, ... colN
> FROM table1
> EXCEPT
> SELECT col1, col2, col3, ... colN
> FROM table2
> ;

Say table1 and table2 both have a primary key of col1, then do:

select table1.col1, table1.col2, table1.col3, ..., table1.colN
from table1
left join table2 on table2.col1 = table1.col1
where table2.col1 is null

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация