﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Query Help / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 20:09:38 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>[quote][b]yogi123 (1/2/2013)[/b][hr][quote][b]Jason-299789 (1/2/2013)[/b][hr]this should work[code="sql"]Select * from #temp2EXCEPTSelect * from #temp1[/code][/quote]Thanks for your helpcan you please solve another way, so i can implement that in my real logic.Thanks For Your Help[/quote]Can you explain why this wouldn't work for you?</description><pubDate>Thu, 03 Jan 2013 09:01:10 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>[quote][b]Jason-299789 (1/3/2013)[/b][hr]Ok, I didnt realise there was any other logic. This is a way to do it with a Left Join [code="sql"]Select t2.*from #temp2 t2Left Join #temp1 t1 on t2.StudentLocalID=t1.StudentLocalID and t2.ScheduleSchoolCode=t1.EnrollSchoolCodewhere 	t1.EnrollSchoolCode is Null[/code]Heres a way with a Not Exists[code="sql"]Select t2.*from #temp2 t2Where NOT EXISTS (Select 1 from #temp1 t1		Where t1.EnrollSchoolCode=t2.ScheduleSchoolCode		and t1.StudentLocalID=t2.StudentLocalID)[/code]Either should enable you to add more logic.[/quote]Thank You so Much This works Awesome</description><pubDate>Thu, 03 Jan 2013 07:02:19 GMT</pubDate><dc:creator>yogi123</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>[quote][b]manikandanps (1/3/2013)[/b][hr]this should work!!!!!Select * from #temp2EXCEPTSelect * from #temp1[/quote]I already provided that solution but the poster needs to add more logic so I've provided the additional solutions, which should allow for more logic to be provided.</description><pubDate>Thu, 03 Jan 2013 00:36:36 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>this should work!!!!!Select * from #temp2EXCEPTSelect * from #temp1</description><pubDate>Thu, 03 Jan 2013 00:24:10 GMT</pubDate><dc:creator>manik123</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>Ok, I didnt realise there was any other logic. This is a way to do it with a Left Join [code="sql"]Select t2.*from #temp2 t2Left Join #temp1 t1 on t2.StudentLocalID=t1.StudentLocalID and t2.ScheduleSchoolCode=t1.EnrollSchoolCodewhere 	t1.EnrollSchoolCode is Null[/code]Heres a way with a Not Exists[code="sql"]Select t2.*from #temp2 t2Where NOT EXISTS (Select 1 from #temp1 t1		Where t1.EnrollSchoolCode=t2.ScheduleSchoolCode		and t1.StudentLocalID=t2.StudentLocalID)[/code]Either should enable you to add more logic.</description><pubDate>Thu, 03 Jan 2013 00:07:31 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>[quote][b]Jason-299789 (1/2/2013)[/b][hr]this should work[code="sql"]Select * from #temp2EXCEPTSelect * from #temp1[/code][/quote]Thanks for your helpcan you please solve another way, so i can implement that in my real logic.Thanks For Your Help</description><pubDate>Wed, 02 Jan 2013 10:44:45 GMT</pubDate><dc:creator>yogi123</dc:creator></item><item><title>RE: Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>this should work[code="sql"]Select * from #temp2EXCEPTSelect * from #temp1[/code]</description><pubDate>Wed, 02 Jan 2013 10:41:40 GMT</pubDate><dc:creator>Jason-299789</dc:creator></item><item><title>Query Help</title><link>http://www.sqlservercentral.com/Forums/Topic1401962-391-1.aspx</link><description>Hello Everyone,I need one query help[code="sql"]create table #temp1(StudentLocalID varchar(9),EnrollSchoolCode Varchar(3))create table #temp2(StudentLocalID varchar(9),ScheduleSchoolCode varchar(3))insert into #temp1 values ('003682153','305')insert into #temp1 values('003682153','303')insert into #temp1 values('003744930','305')insert into #temp1 values('003744930','332')insert into #temp2 values('003682153','305')insert into #temp2 values('003682153','303')insert into #temp2 values('003744930','305')insert into #temp2 values('003744930','303')insert into #temp2 values('003744930','332')[/code]I need to display unmatch ScheduleSchoolCode from EnrollSchoolCode of #temp2 only so desired output is[code="plain"]StudentLocalID	ScheduleSchoolCode003744930	303[/code]</description><pubDate>Wed, 02 Jan 2013 10:39:32 GMT</pubDate><dc:creator>yogi123</dc:creator></item></channel></rss>