让我描述一下我的需求......
我有 2 个 MySQL 数据库表。让我将表名称为进货和出库。首先,我在库存中插入了 15 行,每个条目都有一个唯一编号作为序列号。
mysql> select stockin_id, serialno, description from stockin limit 0,15;
+------------+------------+------------------------------------------+
| stockin_id | serialno | description |
+------------+------------+------------------------------------------+
| 1 | KDR0000001 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 2 | KDR0000002 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 3 | KDR0000003 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 4 | KDR0000004 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 5 | KDR0000005 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 6 | KDR0000006 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 7 | KDR0000007 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 8 | KDR0000008 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 9 | KDR0000009 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 10 | KDR0000010 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 11 | T22ALT5786 | PRINTED BRD ASSMBLY |
| 12 | TU82956450 | FUNCTIONAL UNIT/GSM DXU-21 |
| 13 | X510239240 | FUNCTIONAL UNIT/GSM DXU-21 |
| 14 | TD36843873 | PRINTED BOARD ASSEMB/RP4-F |
| 15 | TD36843908 | PRINTED BOARD ASSEMB/RP4-F |
+------------+------------+------------------------------------------+
15 rows in set (0.00 sec)
现在,我已经从存储在缺货表中的相同序列号的库存产品中转移了一些产品,如下所示 -
mysql> select stockout_id, serialno, description from stockout limit 0,15;
+------------+------------+------------------------------------------+
| stockin_id | serialno | description |
+------------+------------+------------------------------------------+
| 1 | KDR0000001 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 2 | KDR0000002 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 3 | KDR0000003 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
| 4 | KDR0000004 | DATA CARRIER/FLASH CARD WITH RBS 2000 SW |
+------------+------------+------------------------------------------+
4 rows in set (0.00 sec)
现在,我想从库存中选择准确的STOCK-IN HAND条目。我怎样才能实现?