Jump to content

Need Help in getting only data which can suffix the total Qty


newphpcoder

Recommended Posts

What do you I did not alter the data?What table or should i alter?

And also what table or data should I update?

 

I thought dipping table get updated with new quantities ... to zero if completely utilized or to a new number if it partially used.

 

 

If you are not updating the table.. it is very tricky to correlate with table where you inserting the data and display the data for next JO.

 

try this..  I don't have access to mysql server now so I didn't test the code .

 

SELECT SUBSTR(LOT_CODE, 9,4) as pcode, LOT_CODE as code, op_qty,  DATE_ENTRY,   CASE WHEN @t+op_qty > @rqty THEN @rqty  - @t  ELSE op_qty END as qty,@t := @t + d.op_qty as cumulative  from 

((select LOT_CODE,output_qty -qty as op_qty,date_entry from jo_dump where output_qty > qty and SUBSTR(LOT_CODE, 9,4) = '$Comp' order by date_entry desc limit 1) UNION

(select LOT_CODE,output_qty as op_qty ,date_entry from dipping  where date_entry >(select ifnull(date_entry, '0000-00-00') from jo_dump where output_qty > qty and SUBSTR(LOT_CODE, 9,4) = '$Comp' order by date_entry desc limit 1))) d  WHERE (@t < @rqty);

 

Looking at my query I can tell you that...tables design is wrong.

Link to comment
Share on other sites

What do you I did not alter the data?What table or should i alter?

And also what table or data should I update?

 

I thought dipping table get updated with new quantities ... to zero if completely utilized or to a new number if it partially used.

 

 

If you are not updating the table.. it is very tricky to correlate with table where you inserting the data and display the data for next JO.

 

try this..  I don't have access to mysql server now so I didn't test the code .

 

SELECT SUBSTR(LOT_CODE, 9,4) as pcode, LOT_CODE as code, op_qty,  DATE_ENTRY,   CASE WHEN @t+op_qty > @rqty THEN @rqty  - @t  ELSE op_qty END as qty,@t := @t + d.op_qty as cumulative  from 

((select LOT_CODE,output_qty -qty as op_qty,date_entry from jo_dump where output_qty > qty and SUBSTR(LOT_CODE, 9,4) = '$Comp' order by date_entry desc limit 1) UNION

(select LOT_CODE,output_qty as op_qty ,date_entry from dipping  where date_entry >(select ifnull(date_entry, '0000-00-00') from jo_dump where output_qty > qty and SUBSTR(LOT_CODE, 9,4) = '$Comp' order by date_entry desc limit 1))) d  WHERE (@t < @rqty);

 

Looking at my query I can tell you that...tables design is wrong.

 

 

I tried this no error but no output display.

 

 

Thank you

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.