SQL语句
1:多条件查询
select * from stone_back
where (nbadqty+nlqty)>0 and ntranno=000659
select * into stone_back_c6 from stone_back
delete stone_back_c6
2:筛选a表数据添加到b表
insert INTO stone_back_c6 (dtrandate, ntranno, cdeptto, cdeptfrom, nempfrom, nempto, nemploye, cordeno,
nokqty, nokwt, nbadqty, nbadwt, nlqty, nlwt, nreqty, nrewt, CRECODE, lisok,
MIS_D1_ISSUENO_C, MIS_D1_SEQNO_N, MIS_D1_SOWS_NV,
MIS_D1_OUTLOCATION_C, MIS_D1_INLOCATION_C, MIS_D1_STOCKITEMNO_C,
MIS_D1_QTYUOM_C, MIS_D1_LOTNO_C, MIS_D1_QTY_N, MIS_D1_WT_N,
MIS_D1_SUSNO_NV, MIS_D1_POWSNO_C, MIS_D1_ITEMDESC_NV,
MIS_D1_COLOR_NV, MIS_D1_WORDMARKS_NV, MIS_D1_SIZE_NV,
MIS_D1_PRICE_N, MIS_D1_CURRENCY_C, MIS_D1_CURRUOM_C,
MIS_D1_WTUOM_C, MIS_D1_REMARKS_NV, MIS_D1_SUBPOWSNO_NV,
MIS_D1_SONO_NV, MIS_D1_SUBSONO_NV, MIS_D1_SOURCE_NV,
MIS_D1_CUSTNO_NV, MIS_D1_STYLE_NV, MIS_D1_LOSS_N, MIS_D1_DOCNO1_NV,
MIS_D1_DOCNO2_NV, MIO_D1_SPAREQTY_N, MIO_D1_SPAREWT_N,
MIS_D1__GOLDP_N, MIS_D1_GOLDP_N)
select distinct dtrandate, ntranno, cdeptto, cdeptfrom, nempfrom, nempto, nemploye, cordeno,
nokqty, nokwt, nbadqty, nbadwt, nlqty, nlwt, nreqty, nrewt, CRECODE, lisok,
MIS_D1_ISSUENO_C, MIS_D1_SEQNO_N, MIS_D1_SOWS_NV,
MIS_D1_OUTLOCATION_C, MIS_D1_INLOCATION_C, MIS_D1_STOCKITEMNO_C,
MIS_D1_QTYUOM_C, MIS_D1_LOTNO_C, MIS_D1_QTY_N, MIS_D1_WT_N,
MIS_D1_SUSNO_NV, MIS_D1_POWSNO_C, MIS_D1_ITEMDESC_NV,
MIS_D1_COLOR_NV, MIS_D1_WORDMARKS_NV, MIS_D1_SIZE_NV,
MIS_D1_PRICE_N, MIS_D1_CURRENCY_C, MIS_D1_CURRUOM_C,
MIS_D1_WTUOM_C, MIS_D1_REMARKS_NV, MIS_D1_SUBPOWSNO_NV,
MIS_D1_SONO_NV, MIS_D1_SUBSONO_NV, MIS_D1_SOURCE_NV,
MIS_D1_CUSTNO_NV, MIS_D1_STYLE_NV, MIS_D1_LOSS_N, MIS_D1_DOCNO1_NV,
MIS_D1_DOCNO2_NV, MIO_D1_SPAREQTY_N, MIO_D1_SPAREWT_N,
MIS_D1__GOLDP_N, MIS_D1_GOLDP_N
from stone_back
where (nbadqty+nlqty)>0 and ntranno=000659