alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

Find records that do not exist in 2nd table, and also the values mapped against them from first in SQL Server ?

Find records that do not exist in 2nd table, and also the values mapped against them from first in SQL Server ?

From what you say and show, you want to cross join all table 2 rows to the table 1 rows that don't have a match in table 2. For the lookup you can use NOT EXISTS.

 select t2.id, t1.month, t1.year
from t1 cross join t2
where not exists
(
  select null
  from t2
  where t2.year = t1.year and t2.month = t1.month
);

64 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online