get alone zero data.SELECT *FROM TableOfStuAct BASEWHERE NOT EXISTS( SELECT * FROM TableOfStuAct FILTER WHERE FILTER.StudentID = BASE.StudentID AND FILTER.ActibityDate = BASE.ActibityDate AND FILTER.StuActID != BASE.StuActID AND FILTER.MinutesMiles != BASE.MinutesMiles)AND BASE.MinutesMiles = 0
or Other way, get having no pair data.SELECT *FROM TableOfStuAct BASEWHERE NOT EXISTS( SELECT * FROM TableOfStuAct FILTER WHERE FILTER.StudentID = BASE.StudentID AND FILTER.ActibityDate = BASE.ActibityDate AND FILTER.StuActID != BASE.StuActID AND FILTER.MinutesMiles != BASE.MinutesMiles --If application ensure following condition, remove AND 0 IN (FILTER.MinutesMiles, BASE.MinutesMiles) )--Exclude todays progress dataAND NOT ( BASE.ActibityDate = CONVERT(DATE, GETDATE()) AND BASE.MinutesMiles != 0 )
-------------------------------------From JapanSorry, my English ability is limited.