How to get Qty value?

  • Hi Friends,

    I have table  two tables

    desc table1
    company_no varchar(10)
    invoice_no varchar(20)
    locn_no varchar(10)
    model_ref varchar(20)
    item_type  char(10)
    item_code varchar(10)
    QTY  varhcar(20)

    desc table2
     company_no varchar(10)
    order_no varchar(20)
    locn_no varchar(10)
    model_no varchar(10)
    item_code varchar(10)
    formula_code varchar(10)

    insert into table1 values ('ABC','INv1/001/1718','CHN','#','K','6001' ,48)
    ('ABC','INv1/001/1718','CHN','6001','X','5010',4.8)
    ('ABC','INv1/001/1718','CHN','6001','X','5011',48)

    insert into table2 values
    ('ABC','SO/00010/1718','CHN','6001',''5010','0.10')
    ('ABC','SO/00010/1718','CHN','6001',''5011','1.00')

    this kind of values i have on those tables

    in table1 600 series kit 500 item code which have sales qty and free qty

    i want to show the display

    company_no locn_no invoice_no    order_no    item_code QTY

    ABC    CHN  INv1/001/1718   SO/00010/1718   6001  48
    ABC    CHN  INv1/001/1718   SO/00010/1718   5010  4.80
    ABC    CHN  INv1/001/1718   SO/00010/1718   5011  0

    here based the item code formula i have to multiply (if the formula is below on i can show value (0.10*48) 5010=4.80 suppose the formula is greater than 1 or equlas i have to take the itemcode (1*48) 5011=0 to subtract from kit qty )

    Kinldy solve the issue

  • raghuldrag - Thursday, November 23, 2017 5:36 AM

    Kinldy solve the issue

    We're not here to do your job or your homework for you, but if you show us what you've already tried, we can give you some pointers.  From your description, it sounds as if you need to use a CASE expression.  I can't work out what column(s) you are joining the tables on.

    John

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply