Please:
post data in usable form
post the expected result with the data you have posted
reduce the data, so that is only shows all cases you have/expect
Have you thought about normalizing the data? Having numbered columns is almost always a sign for bad data-design. In your case having two tables, one with ID and one infusion_date and the other table with ID and one labdate, maybe a sql-merge could solve the problem.
... View more