Select Id, case when dtk1 = lag(dtk1,1) and dtk2 = lag(dtk2,1) and dtk3 = lag(dtk3,1) and dtk4 = lag(dtk4,1) then id + ’ ’ + lag(Id,1) Else ID end as ConcatenatedID, DTK1,DTK2,DTK3,DTK4
Order by id
Actually, am not connecting to DB, i am just reading a data from excel and convert it as Datatable. From the converted datatable i want to execute the query mentioned and filter out the datatable.