Hi,
I have a query that will select the same tables and using Subquery. The query is taking too much time as the table has more records. Can anyone help to modify the query which can take minimum time. Thanks in Advance.
Below is the query
SELECT SIK_ROLLE_ID,SIK_OBJEKT_ID,SIK_AFTALE_ID,SIK_AFTALE_TP,ROLLE_TP,KNID,EJENDOMS_ID,EJENDOMS_TP, VURD_BLB ,VURD_VAKD,VURD_DT,HAIRCUT,SIK_VAKD,SIK_FOER_BLB,HAIRCUT_BLB,FORANST_PRIO_BLB,RETTIGHEDER_BLB,SIK_EFTER_BLB ,OVERSKREVET_MK,OVERSKREVET_BLB,MAN_HAIRCUT_BLB,MAN_OBJ_E_HCUT_BLB,GLDER_FRA_DT, TRANSAKTIONS_TP,SIK_STATUS_TP FROM ETZ3EDW.dbo.EWWH_KS_OBJ_KND2_HV A WHERE A.SIK_AFTALE_TP = 20130 and A.TRANSAKTIONS_TP not in ('S') AND A.GLDER_FRA_DT = ( SELECT MAX(B.GLDER_FRA_DT) FROM ETZ3EDW.DBO.EWWH_KS_OBJ_KND2_HV B WHERE B.GLDER_FRA_DT <= '2014-01-08' AND A.SIK_OBJEKT_ID = B.SIK_OBJEKT_ID AND A.SIK_AFTALE_ID = B.SIK_AFTALE_ID)