Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: comparing two table Date: Fri, 11 Nov 2011 23:40:10 +0100 Organization: Erland Sommarskog Lines: 35 Message-ID: References: <2ddbf504-fed9-415e-ac73-8a2839ea0588@w20g2000prc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="6334"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hg4Il/IAwJBU2M7IVeMbC" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:DygYqBU7Q7+vYtZ4Fuqh2dfJOcM= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:801 John Kim (jinumarketing@gmail.com) writes: > i have two tables. > > one table - tbl_attempted issue has number field with the following > values. > > > number field record values - 1, 3, 4, 5 > > > the other table - tbl_issues_out has another number field with the > following value. > > > number field record value - 7 > > > IS THERE A WAY TO CHECK THESE TWO TABLES and come up with values, > > > 2, 6 You need a table with numbers, that is a table that has all numbers from 1 and up. Read more here: http://www.sommarskog.se/arrays-in-sql-2005.html#tblnum You should only to read down to the header "An Inline Function". -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx