Selecting the right date in sub-query

Post has been withdrawn and deleted