select * from [Migration].[tbl_site_survey_view] where Location_id not in ( select distinct location_id from [Migration].[tbl_prop_code_view] where prop_code in ( select code from NGN.Property where id in ( select PropertyID from [sitesurvey].[sitesurveydetail] --where id=@siteSurveyId ) ) ) -------------- select * from stationreview.stationreviewdetail ---------- select * from migration.tbl_statrev_loc_view --- 687 select * from stationreview.stationreviewdetail - 679 -- Missing data in stationreview.stationreviewdetail table select * from migration.tbl_statrev_loc_view where Location_id not in ( select distinct location_id from migration.tbl_statrev_loc_view where property_code in ( select code from NGN.Property where id in ( select PropertyID from stationreview.stationreviewdetail ) ) ) select * from stationreview.stationreviewdetail select * from migration.tbl_statrev_loc_view where location_id = 7503 select * from ngn.property where code = 300073 select property_code,COUNT(property_code) from migration.tbl_statrev_loc_view group by property_code having (count(property_code)>1) ORDER BY COUNT(property_code) DESC 152180 152782 153005 153350 select * from ngn.property where code = 152581 select * from migration.tbl_statrev_loc_view where property_code = 152328 select * from stationreview.stationreviewdetail where propertyid = '1E39D177-87F6-40D9-A906-520F11B3D260' --propertycode available in ngn.property 152429,152328,152971,152581 select * from migration.tbl_statrev_loc_view where property_code = 152429 select * from stationreview.statationreviewdetatil select prop_code,COUNT(prop_code) from [Migration].[tbl_prop_code_view] group by prop_code having (count(prop_code)>1) ORDER BY COUNT(prop_code) DESC ----------