Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have checked several thread of stackoverflow.com against my problem. Let me describe the my problem.

I have generated a query to get available stock based on serialno cross checking between stockin and stockout table. My query is working fine at phpMyAdmin with no problem with correct equation. But, when I am creating a php script to download as a CSV file. Stockinhand is limiting at 5849 and CSV file row is 6041.

Stockin Hand equation is as follows- SUM(in_quantity) - SUM(out_quantity) GROUP BY serialno.

Stockin Hand Code as follows-

SELECT 
        t1.inqty, IFNULL(t2.outqty, '0') outqty, (IFNULL(t1.inqty,'0') - IFNULL(t2.outqty, '0')) totalHand, 
            t1.serialno, t1.inserteddate
        FROM
            (
                SELECT *, SUM(in_quantity) inqty FROM stockin GROUP BY serialno
            ) t1 LEFT JOIN
            (
                SELECT serialno, SUM(out_quantity) outqty FROM stockout GROUP BY serialno
            ) t2
        ON t1.serialno = t2.serialno

Downloading the CSV file fine without any errors.

Please help me to find out the problem.

share|improve this question
Please post some code. – Mike W 13 mins ago

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.