strSql.Append(" from crm_seaeorder B WITH (NOLOCK)");
strSql.Append(" from crm_seaeorder B WITH (NOLOCK)");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
strSql.Append(" left join (select * from( select *,row_number() over (partition by EDICODE order by CHAU desc) as rownum from (select EDICODE,COUNTRY,CHAU from code_disport union all select PORTENAME EDICODE,COUNTRY,'' CHAU from code_air_port)t4) t3 where t3.rownum = 1) cd on B.DESTINATIONID = cd.EDICODE ");
strSql.Append(" left join (select * from( select *,row_number() over (partition by EDICODE order by CHAU desc) as rownum from (select EDICODE,COUNTRY,CHAU from code_disport union all select PORTENAME EDICODE,COUNTRY,'' CHAU from code_air_port)t4) t3 where t3.rownum = 1) cd on B.DESTINATIONID = cd.EDICODE ");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
//strSql.Append(" left join (select t3.* from (select *,row_number() over (partition by EDICODE order by portid asc) as rownum from code_disport) t3 where t3.rownum = 1 ) cd on B.DESTINATIONID = cd.EDICODE ");
strSql.Append(" left join (select * from( select *,row_number() over (partition by EDICODE order by CHAU desc) as rownum from (select EDICODE,COUNTRY,CHAU from code_disport union all select PORTENAME EDICODE,COUNTRY,'' CHAU from code_air_port)t4) t3 where t3.rownum = 1) cd on B.DESTINATIONID = cd.EDICODE ");
strSql.Append(" left join (select * from( select *,row_number() over (partition by EDICODE order by CHAU desc) as rownum from (select EDICODE,COUNTRY,CHAU from code_disport union all select PORTENAME EDICODE,COUNTRY,'' CHAU from code_air_port)t4) t3 where t3.rownum = 1) cd on B.DESTINATIONID = cd.EDICODE ");