return" SELECT [CTN_ID],[ORDNO],[CTNALL],[CTNNUM],[TEU],[CNTRNO],[SEALNO],[PKGS],[KINDPKGS],[KGS],[CBM],[TAREWEIGHT],[CTNSTATUS],[WEIGHTYPE],[WEIGHKGS],[WEIGHATTN],[VGMCONNCOM],[WEIGHTEL],[WEIGHDATE],[VGMADDR],[VGMEMAIL],[REMARK] ,(select bsno from OP_SEAE_ORDER where ORDNO in(select ORDNO from op_seae_si where SINO=[OP_SI_CTN].ORDNO)) BSNO_PARENT,(select bsno from OP_SEAE_ORDER where ORDNO =[OP_SI_CTN].ORDNO) BSNO,(select MBLNO from OP_SEAE_SI where SINO =[OP_SI_CTN].ORDNO) SI_MBLNO FROM [OP_SI_CTN] ";
return" SELECT [CTN_ID],[ORDNO],[CTNALL],"+
"case when isnull(CNTRNO,'')<>'' then 1 else [CTNNUM] end as CTNNUM,[TEU],[CNTRNO],[SEALNO],[PKGS],[KINDPKGS],[KGS],[CBM],[TAREWEIGHT],[CTNSTATUS],[WEIGHTYPE],[WEIGHKGS],[WEIGHATTN],[VGMCONNCOM],[WEIGHTEL],[WEIGHDATE],[VGMADDR],[VGMEMAIL],[REMARK] ,(select bsno from OP_SEAE_ORDER where ORDNO in(select ORDNO from op_seae_si where SINO=[OP_SI_CTN].ORDNO)) BSNO_PARENT,(select bsno from OP_SEAE_ORDER where ORDNO =[OP_SI_CTN].ORDNO) BSNO,(select MBLNO from OP_SEAE_SI where SINO =[OP_SI_CTN].ORDNO) SI_MBLNO FROM [OP_SI_CTN] ";