Ecco la Query....
SELECT dp.TESTO17_3 Commessa, dp.NUMERO NumeroTavola, dp.NUMERIC4_3 RevisioneOVS, '?' PlannedDueDate,
testa.NumeroDisegnoCliente, testa.ContractualDueDate,
dp.Data155_3 ActualSubmissionDate, dp.DATA156_3 CommentDeliveryDate, dp.Data157_3 DataDistribuzioneInterna, dp.combo84_6 StatoDistribuzioneInterna,
dp.COMBO10_3 ClientStatus
FROM DM_PROFILE dp
JOIN (
SELECT dp4.numero, dp2.TESTO3_3 NumeroDisegnoCliente, dp3.DATA7_3 ContractualDueDate
FROM DM_PROFILE dp4
--Collego Tavola a Drawing
JOIN DM_CAMPICLASSE_LEGAMI dcl ON dcl.DOCNUMBERTO = dp4.DOCNUMBER AND dcl.CAMPOCLASSEID = 'CLASSE57_9'
JOIN DM_PROFILE dp2 ON dp2.DOCNUMBER = dcl.DOCNUMBERFROM
--Collego Drawing a Lotto
JOIN DM_CAMPICLASSE_LEGAMI dcl2 ON dcl2.DOCNUMBERTO = dp2.DOCNUMBER AND dcl2.CAMPOCLASSEID = 'CLASSE44_10'
JOIN DM_PROFILE dp3 ON dp3.DOCNUMBER = dcl2.DOCNUMBERFROM
WHERE dp4.DOCUMENTTYPE = 4 AND dp4.TIPO2 = 6 AND dp4.TIPO3 = 0
) testa ON Testa.NUMERO = dp.NUMERO
WHERE dp.DOCNUMBER IN
(
SELECT DOCNUMBER FROM DM_PROFILE
WHERE dp.TESTO17_3 = '4714' AND DOCUMENTTYPE = 4 AND TIPO2 = 6 AND TIPO3 = 0
)
ORDER BY NumeroTavola, RevisioneOVS