Hi all ,
Below i have two tables , 1st table contain 12 records and second one contain 8 records. now i need to get remain 4 records only not with 8 records using joins in sql. i have tried below query but still am not getting .please help on this
Select DISTINCT it.ShapeName,it.Intervalyear,it.IntervalMonth from @yearTable yt
left JOIN @IntervalTable it on yt.NumDays=it.IntervalNumDays
where it.Intervalyear is null and it.IntervalNumDays='2018'
rajendra singhRank #1,521 · 1K reputationPosted Aug 29, 2018, 1:57 AM EDT
venkat144 reputationPosted Aug 29, 2018, 2:16 AM EDT
rajendra singhRank #1,521 · 1K reputationPosted Aug 29, 2018, 9:19 PM EDT
Packiaraj SanthiyaguRank #659 · 3.6K reputationPosted Aug 29, 2018, 11:54 PM EDT
Gaurav Raut81 reputationPosted Sep 6, 2018, 3:43 AM EDT
Hello Venkat,
please try below mentioned query
Select * from [yearTable] yt
left JOIN [IntervalTable] it on yt.year=it.Intervalyear and it.Intervalmonth = month
select * from yearTable where month not in (select intervalmonth from IntervalTable where [intervalyear] = 2018)
Jayesh VaghasiyaRank #9,790 · 202 reputationPosted Sep 17, 2018, 7:08 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts