[COLOR=#1f497d][FONT=Arial]SELECT Format([DEPART_ACTUAL_DT],'yyyymm') AS CostMonth, dbo_MG_VESSEL_VOYAGE.SERVICE_CD, dbo_MG_VESSEL_VOYAGE.OPERATOR_CD, dbo_MG_VESSEL_SCHEDULE.VESSEL_CD, dbo_MG_VESSEL_SCHEDULE.VOYAGE_CD, dbo_MG_VESSEL_SCHEDULE.LEG_CD, dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD, dbo_MG_VESSEL_SCHEDULE.DEPOT_CD, dbo_MG_VESSEL_SCHEDULE.DEPART_ACTUAL_DT, dbo_MG_VESSEL_SCHEDULE.DEPART_STATUS_FLG, dbo_MG_VESSEL_VOYAGE.DELETED_FLG, dbo_MG_VESSEL_SCHEDULE.CALLING_PURPOSE_CD, dbo_MG_VESSEL_SCHEDULE.PORT_SEQUENCE_ID INTO tbl_SAI_PortProspectsTemp FROM dbo_MG_VESSEL_SCHEDULE INNER JOIN dbo_MG_VESSEL_VOYAGE ON (dbo_MG_VESSEL_SCHEDULE.LEG_CD = dbo_MG_VESSEL_VOYAGE.LEG_CD) AND (dbo_MG_VESSEL_SCHEDULE.VESSEL_CD = dbo_MG_VESSEL_VOYAGE.VESSEL_CD) AND (dbo_MG_VESSEL_SCHEDULE.VOYAGE_CD = dbo_MG_VESSEL_VOYAGE.VOYAGE_CD) WHERE (((dbo_MG_VESSEL_VOYAGE.SERVICE_CD)Like '*I') AND ((dbo_MG_VESSEL_VOYAGE.OPERATOR_CD)='U') AND ((dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'GB*' Or (dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'DE*' Or (dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'NL*' Or (dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'DK*' Or (dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'SE*') AND ((dbo_MG_VESSEL_SCHEDULE.DEPART_ACTUAL_DT) Between # 01/03/2011# And #31/03/2011#) AND ((dbo_MG_VESSEL_VOYAGE.DELETED_FLG)='N') AND ((dbo_MG_VESSEL_SCHEDULE.CALLING_PURPOSE_CD)<>'C') AND ((dbo_MG_VESSEL_SCHEDULE.PORT_SEQUENCE_ID)=1)) OR (((dbo_MG_VESSEL_VOYAGE.SERVICE_CD)Like 'I*') AND ((dbo_MG_VESSEL_VOYAGE.OPERATOR_CD)='U') AND ((dbo_MG_VESSEL_SCHEDULE.PORT_OF_CALL_CD) Like 'PT*') AND ((dbo_MG_VESSEL_SCHEDULE.DEPART_ACTUAL_DT)Between # 01/03/2011# And #31/03/2011#) AND ((dbo_MG_VESSEL_VOYAGE.DELETED_FLG)='N') AND ((dbo_MG_VESSEL_SCHEDULE.CALLING_PURPOSE_CD)<>'C') AND ((dbo_MG_VESSEL_SCHEDULE.PORT_SEQUENCE_ID)=2));[/FONT][/COLOR]