Your SQL habits could use some improvement. ;-)
You probably need to stop trying to use the column number in your ORDER BY clause and, instead of using the 4 use CD_WELLBORE_FORMATION.update_date (or whichever column name you are wanting to actually order by).
Also, look at the following:
dbo_CD_DATUM.well_id + dbo_CD_DATUM.datum_id
If those are character strings, then you need to use an ampersand (&) to concatenate them plus you probably want to wrap that in parenthesis:
OR (dbo_CD_DATUM.well_id + dbo_CD_DATUM.datum_id) IN ('03q2DecAl4nlEgX',
'86zNT2KSuII6yfH', ... , 'ZILDpIPYMHfWqVj')
You might want to put an alias on the following line:
dbo_CD_WELLBORE_FORMATION.prognosed_md + NZ(dbo_CD_DATUM.datum_elevation, 0),