How to generate simple Packing List with MySQL ?

Posted by Stephen on Stack Overflow See other posts from Stack Overflow or by Stephen
Published on 2009-10-24T05:34:51Z Indexed on 2010/04/01 9:03 UTC
Read the original article Hit count: 976

Filed under:
|
|

Hi,

I need help on how to create a packing list of a shipment with MySQL.

Let's say i have 32 boxes of keyboard ready to ship, the master carton can contain 12 boxes.

I only have value 32 boxes and volume of 12. The other value in result below is generated by sql command. Not coming from record.

So this easily calculate that the number of master carton would be 3 master cartons, with one as a non-standard quantity. How to perform query on this ?

As i would like to be this result:

+----------+---------------+-------------------+--------+------------+---------+
| Quantity | Standard_Qty  | Non_Standard_Qty  | Box_N  | Box_Total  | RowType |
+----------+---------------+-------------------+--------+------------+---------+
|       12 |             1 |                 0 |      1 |          3 | Detail  |
|       12 |             1 |                 0 |      2 |          3 | Detail  |
|        8 |             0 |                 1 |      3 |          3 | Detail  |
|       32 |             2 |                 1 |        |            | Summary |
+----------+---------------+-------------------+--------+------------+---------+

It looks like two query i know and probably the use of FLOOR command, in which i was teach in here. How to make this result?

Thanks in advance. Stephen

© Stack Overflow or respective owner

Related posts about mysql

Related posts about packing

  • 2D packing with obstacles

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Anybody know of an efficient algorithm for moving rectangles in a square which contains obstacles? Rectangles: can rotate can move must not collide with obstacles (black squares) Obstacles: can't be moved can be added anywhere Goal: move rectangles until you can >>> More

  • C/C++ packing signed char into int

    as seen on Stack Overflow - Search for 'Stack Overflow'
    hello I have need to pack four signed bytes into 32-bit integral type. this is what I came up to: int byte(char c) { return (unsigned char)c; } int pack(char c0, char c1, ...) { return byte(c0) | byte(c1) << 8 | ...; } is this a good solution? Is it portable? is there a ready-made solution… >>> More

  • Packing a DBF

    as seen on Geeks with Blogs - Search for 'Geeks with Blogs'
    I thought my days of dealing with DBFs as a "production data" source were over, but HA (no such luck). I recently had to retrieve, modify and replace some data that needed to be delivered in a DBF file. Everything was fine until I realized / remembered the DBF driver does not ACTUALLY delete records… >>> More

  • Packing a DBF

    as seen on Geeks with Blogs - Search for 'Geeks with Blogs'
    I thought my days of dealing with DBFs as a "production data" source were over, but HA (no such luck). I recently had to retrieve, modify and replace some data that needed to be delivered in a DBF file. Everything was fine until I realized / remembered the DBF driver does not ACTUALLY delete records… >>> More

  • Bin packing part 6: Further improvements

    as seen on SQL Blog - Search for 'SQL Blog'
    In part 5 of my series on the bin packing problem, I presented a method that sits somewhere in between the true row-by-row iterative characteristics of the first three parts and the truly set-based approach of the fourth part. I did use iteration, but each pass through the loop would use a set-based… >>> More