943,663 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 958
  • MS SQL RSS
Oct 1st, 2008
0

Compare 2 tables

Expand Post »
Below query for comparing 2 tables and extract the uncommon like GUID X121 doesn’t exists in the 2nd table and the GUID which are unsuccessful (has –ve values).
select isnull(pt.GUID,Wo.GUIS)as GUID,
pt.[ErrorNo] as Error
from PieTreace pt
full outer join WorkMessage Wm
on pt.GUID = Wm.GUID
where(pt.GUId is null) or (pt.[ErrorNo]<0)
Along with above query I want to extract those,ErroNo and GUID which are unsuccessful for first time and next time(It may be second time or third time)it’s successful, with the lastest date.(I have marked those repeating GUID with red colour.)

Thanks.
Attached Files
File Type: doc Tables.doc (35.0 KB, 13 views)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cheluvaraj is offline Offline
1 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Select a Set of rows from a table
Next Thread in MS SQL Forum Timeline: display all the records in table in SQL using VBScript in ASP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC