Thinker

Personal e-notepad


    跨Table赋值/拿数据

    Aueeins
    Aueeins
    水面上的小草

    帖子数 : 173
    积分 : 3435
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    跨Table赋值/拿数据 Empty 跨Table赋值/拿数据

    Post by Aueeins on 19/09/11, 02:24 pm







    select * from m02sales WHERE VOUCHERNUMBER='AR201109-0003' 主要的发票单




    SELECT TOP 1 REFTYPE FROM m02salesDET WHERE VOUCHERNUMBER='AR201109-0003' AND SUBCODE='RICS' ORDER BY CODE 4个中的最主要的第一个产品信息




    SELECT ITEMSNO FROM M21RENTALITEMS WHERE RENTITEMID='REIT201109-000001' 根据产品号 找到了他的序列号



    UPDATE m02sales SET MAINDETREF ='????????????????????' WHERE VOUCHERNUMBER='AR201109-0003' update回去到主要的发票单的下脚



    UPDATE m02sales SET MAINDETREF =(SELECT ITEMSNO FROM M21RENTALITEMS WHERE RENTITEMID=(SELECT TOP 1 REFTYPE FROM m02salesDET WHERE VOUCHERNUMBER='AR201109-0003' AND SUBCODE='RICS' ORDER BY CODE )) WHERE VOUCHERNUMBER='AR201109-0003'



    cls00connection.update("UPDATE m02sales SET MAINDETREF =(SELECT ITEMSNO FROM M21RENTALITEMS WHERE RENTITEMID=(SELECT TOP 1 REFTYPE FROM m02salesDET WHERE VOUCHERNUMBER='" & cls00regional.string_filter(strVOUCHERNUMBER) & "'AND SUBCODE='RICS' ORDER BY CODE )) WHERE VOUCHERNUMBER='" & cls00regional.string_filter(strVOUCHERNUMBER) & "'")




    markeloff
    markeloff
    无尽星空

    帖子数 : 244
    积分 : 3538
    威望 : 0
    注册日期 : 2011-09-06
    年龄 : 31
    地点 : Singapore

    跨Table赋值/拿数据 Empty Re: 跨Table赋值/拿数据

    Post by markeloff on 20/09/11, 05:46 am

    拼SQL语句

      Current date/time is 22/02/20, 01:29 pm