I have a select statement that
selects studentid, studentjoiningdate, studentchargedhours, case when std.studentjoiningdate=.H.Date then std.studentchargedhours else 0 end
from student std left join dbo.state st on st.stateid = std.state
where std.studentid = '3456' --- hece it returns here 5 rows for this id.
left join DepartmentDate H on std.State = H.State -- here it returning all the rows.
there are no rows matching in the DepartmentDate with student table joining date columns. how to avoid these rows to pick only 5 rows
I have to do left join with departmentdate table , there is case statement in select list i am comparing std table joining date with departmentdate table date. if it matches then do some logic..