Miks
the old 7.0 sql
SELECT ' ' as cc_tradeterm,
' ' as cc_payterm,
' ' as cc_delivery,
' ' as cc_packing,
' ' as cc_remark,
' ' as cc_destination,
' ' as cc_shipmark,
' ' as cc_lcno,
' ' as cc_bank,
' ' as cc_vessel,
' ' as cc_buyerno,
' ' as cc_aboard,
' ' as cc_portload,
' ' as cc_portdischarge,
' ' as cc_wgross,
' ' as cc_originmat,
' ' as cc_manufacturer,
' ' as cc_picfname,
' ' as cc_stno,
' ' as cc_netamt_text,
' ' as cc_salesname,
' ' as cc_cname,
isnull(st_stno,' ') as st_stno,
isnull(st_desc,' ') as st_desc,
isnull(st_cdesc, ' ') as st_cdesc,
isnull(st_edition, ' ') as st_edition,
isnull(st_isbn, ' ') as st_isbn,
plhdr.pl_sysplno ,
case pl_revision when 0 then pl_plno else pl_plno + ' - ' + convert(varchar, pl_revision) end as pl_plno,
plhdr.pl_cuno ,
plhdr.pl_sconame ,
plhdr.pl_saddr1 ,
plhdr.pl_saddr2 ,
plhdr.pl_saddr3 ,
plhdr.pl_saddr4 ,
plhdr.pl_pldate ,
plhdr.pl_shipdate ,
plhdr.pl_syssino ,
plhdr.pl_payterms ,
plhdr.pl_volunit ,
plhdr.pl_revision ,
plhdr.pl_customf1 ,
plhdr.pl_customf2 ,
plhdr.pl_customf3 ,
plhdr.pl_customf4 ,
plhdr.pl_customf5 ,
plhdr.pl_customf6 ,
plhdr.pl_customf7 ,
plhdr.pl_customf8 ,
plhdr.pl_customf9 ,
plhdr.pl_customf10 ,
plhdr.pl_customf11 ,
plhdr.pl_customf12 ,
plhdr.pl_customf13 ,
plhdr.pl_customf14 ,
plhdr.pl_customf15 ,
plhdr.pl_customf16 ,
plhdr.pl_customf17 ,
plhdr.pl_customf18 ,
plhdr.pl_customf19 ,
plhdr.pl_customf20 ,
plhdr.pl_customf31 ,
plhdr.pl_custom_df1 ,
plhdr.pl_custom_df2 ,
plhdr.pl_custom_nf1 ,
plhdr.pl_custom_nf2 ,
plhdr.pl_custom_mf1 ,
plhdr.pl_custom_mf2 ,
pldtl.pt_sysplno ,
pldtl.pt_seqno ,
pldtl.pt_sysstno ,
pldtl.pt_qty ,
pldtl.pt_desc ,
pldtl.pt_packfromto ,
pldtl.pt_packtot ,
pldtl.pt_packqty ,
pldtl.pt_umno ,
pldtl.pt_wgross ,
pldtl.pt_wnet ,
IsNull(pt_length , 0 ) as pt_length,
IsNull(pt_width , 0 ) as pt_width,
IsNull(pt_height , 0 ) as pt_height,
pldtl.pt_picfname ,
pldtl.pt_shipmark ,
pldtl.pt_printsmondig ,
pldtl.pt_customf1 ,
pldtl.pt_customf2 ,
pldtl.pt_customf3 ,
pldtl.pt_customf4 ,
pldtl.pt_customf5 ,
pldtl.pt_memo ,
pldtl.pt_memo2 ,
pldtl.pt_custom_nf1 ,
pldtl.pt_custom_nf2 ,
pldtl.pt_custom_df1 ,
pldtl.pt_custom_df2 ,
pldtl.pt_sortseqno ,
pldtl.pt_volume ,
pldtl.pt_innerbox ,
pldtl.pt_outerbox,
IsNull(pt_measure_unit, '') as pt_measure_unit,
IsNull(pt_weight_unit, '') as pt_weight_unit,
PL_CONAME,
so_billdate,
so_country,
isnull(so_pono, ' ') as so_pono,
isnull(so_custpono,' ') as so_custpono,
isnull(so_sono, ' ') as so_sono,
0 as cc_si_sino,
pt_fromcar,
pt_tocar,
plhdr.pl_customf29 ,
plhdr.pl_customf30 ,
cu_phone1,
cu_faxno1,
' ' as cf_packing_t,
' ' as cf_shipment_t,
' ' as pl_customf7_t,
' ' as pl_customf8_t,
' ' as pl_customf9_t,
' ' as pl_customf10_t,
' ' as pl_custom_mf1_t,
' ' as pl_custom_mf2_t
FROM pldtl ,
plhdr, sohdr, stock, customer
WHERE ( plhdr.pl_sysplno = pldtl.pt_sysplno )
and ( pt_syssono *= so_syssono)
and ( pt_sysstno *= st_sysstno)
and ( pl_cuno = cu_cuno )
and ( pt_itemno IS NULL or rtrim(ltrim(pt_itemno))='')
I revised sql as your suggested
SELECT ' ' as cc_tradeterm,
' ' as cc_payterm,
' ' as cc_delivery,
' ' as cc_packing,
' ' as cc_remark,
' ' as cc_destination,
' ' as cc_shipmark,
' ' as cc_lcno,
' ' as cc_bank,
' ' as cc_vessel,
' ' as cc_buyerno,
' ' as cc_aboard,
' ' as cc_portload,
' ' as cc_portdischarge,
' ' as cc_wgross,
' ' as cc_originmat,
' ' as cc_manufacturer,
' ' as cc_picfname,
' ' as cc_stno,
' ' as cc_netamt_text,
' ' as cc_salesname,
' ' as cc_cname,
// isnull(st_stno,'') as st_no,
// isnull(st_desc,' ') as st_desc,
// isnull(st_cdesc, ' ') as st_cdesc,
// isnull(st_edition, ' ') as st_edition,
// isnull(st_isbn, ' ') as st_isbn,
plhdr.pl_sysplno ,
case pl_revision when 0 then pl_plno else pl_plno + ' - ' + convert(varchar, pl_revision) end as pl_plno,
plhdr.pl_cuno ,
plhdr.pl_sconame ,
plhdr.pl_saddr1 ,
plhdr.pl_saddr2 ,
plhdr.pl_saddr3 ,
plhdr.pl_saddr4 ,
plhdr.pl_pldate ,
plhdr.pl_shipdate ,
plhdr.pl_syssino ,
plhdr.pl_payterms ,
plhdr.pl_volunit ,
plhdr.pl_revision ,
plhdr.pl_customf1 ,
plhdr.pl_customf2 ,
plhdr.pl_customf3 ,
plhdr.pl_customf4 ,
plhdr.pl_customf5 ,
plhdr.pl_customf6 ,
plhdr.pl_customf7 ,
plhdr.pl_customf8 ,
plhdr.pl_customf9 ,
plhdr.pl_customf10 ,
plhdr.pl_customf11 ,
plhdr.pl_customf12 ,
plhdr.pl_customf13 ,
plhdr.pl_customf14 ,
plhdr.pl_customf15 ,
plhdr.pl_customf16 ,
plhdr.pl_customf17 ,
plhdr.pl_customf18 ,
plhdr.pl_customf19 ,
plhdr.pl_customf20 ,
plhdr.pl_customf31 ,
plhdr.pl_custom_df1 ,
plhdr.pl_custom_df2 ,
plhdr.pl_custom_nf1 ,
plhdr.pl_custom_nf2 ,
plhdr.pl_custom_mf1 ,
plhdr.pl_custom_mf2 ,
pldtl.pt_sysplno ,
pldtl.pt_seqno ,
pldtl.pt_sysstno ,
pldtl.pt_qty ,
pldtl.pt_desc ,
pldtl.pt_packfromto ,
pldtl.pt_packtot ,
pldtl.pt_packqty ,
pldtl.pt_umno ,
pldtl.pt_wgross ,
pldtl.pt_wnet ,
IsNull(pt_length , 0 ) as pt_length,
IsNull(pt_width , 0 ) as pt_width,
IsNull(pt_height , 0 ) as pt_height,
pldtl.pt_picfname ,
pldtl.pt_shipmark ,
pldtl.pt_printsmondig ,
pldtl.pt_customf1 ,
pldtl.pt_customf2 ,
pldtl.pt_customf3 ,
pldtl.pt_customf4 ,
pldtl.pt_customf5 ,
pldtl.pt_memo ,
pldtl.pt_memo2 ,
pldtl.pt_custom_nf1 ,
pldtl.pt_custom_nf2 ,
pldtl.pt_custom_df1 ,
pldtl.pt_custom_df2 ,
pldtl.pt_sortseqno ,
pldtl.pt_volume ,
pldtl.pt_innerbox ,
pldtl.pt_outerbox,
IsNull(pt_measure_unit, '') as pt_measure_unit,
IsNull(pt_weight_unit, '') as pt_weight_unit,
PL_CONAME,
so_billdate,
so_country,
isnull(so_pono, ' ') as so_pono,
isnull(so_custpono,' ') as so_custpono,
isnull(so_sono, ' ') as so_sono,
0 as cc_si_sino,
pt_fromcar,
pt_tocar,
plhdr.pl_customf29 ,
plhdr.pl_customf30 ,
cu_phone1,
cu_faxno1,
' ' as cf_packing_t,
' ' as cf_shipment_t,
' ' as pl_customf7_t,
' ' as pl_customf8_t,
' ' as pl_customf9_t,
' ' as pl_customf10_t,
' ' as pl_custom_mf1_t,
' ' as pl_custom_mf2_t
// FROM pldtl ,
// plhdr, sohdr, stock, customer
// WHERE ( plhdr.pl_sysplno = pldtl.pt_sysplno )
// and ( pt_syssono *= so_syssono)
// and ( pt_sysstno *= st_sysstno)
// and ( pl_cuno = cu_cuno )
// and ( pt_itemno IS NULL or rtrim(ltrim(pt_itemno))='')
from pldtl left outer join stock on pt_sysstno = st_sysstno left outer join sohdr on pt_sysstno = so_syssono,
JOIN customer ON pl_cuno = cu_cuno
JOIN plhdr ON plhdr.pl_sysplno = pldtl.pt_sysplno
where
( pt_itemno IS NULL or rtrim(ltrim(pt_itemno))='')
but run report as fellow mesasge
would you have any suggestion
William
regards