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'
Jayesh VaghasiyaPosted Sep 17, 2018, 11:08 PM
Gaurav RautPosted Sep 6, 2018, 7:43 AM
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)
Packiaraj SanthiyaguPosted Aug 30, 2018, 3:54 AM
rajendra singhPosted Aug 30, 2018, 1:19 AM
venkatPosted Aug 29, 2018, 6:16 AM
rajendra singhPosted Aug 29, 2018, 5:57 AM