MySQL操作程序四十一(mscown_start.pl,mscown_start.htm)

返回


debug1 -------------------------------------- [Mon Jan 02 22:27:06 2012] [error] [client 127.0.0.1] "my" variable %seen masks earlier declaration in same statement at ./pro/mscown_start.pl line 12.\r, referer: http://127.0.0.1/ my(%t,@rec,$n,$a_ref,$enq1ref,$aref,%seen,$item,$row,@loop,%seen); ==>有两个%seen! my(%t,@rec,$n,$a_ref,$enq1ref,$aref,%seen,$item,$row,@loop);
mysql> UPDATE order1 SET posttime = '2010-01-01'; Query OK, 12394 rows affected (0.39 sec) Rows matched: 12394 Changed: 12394 Warnings: 0 mysql> UPDATE order1 SET paytime = '2010-01-01'; Query OK, 12394 rows affected (0.33 sec) Rows matched: 12394 Changed: 12394 Warnings: 0 mysql> ALTER TABLE order1 DROP COLUMN paytime; Query OK, 12394 rows affected (1.83 sec) Records: 12394 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE order1 DROP COLUMN posttime; Query OK, 12394 rows affected (1.05 sec) Records: 12394 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE order1 ADD posttime DATE NOT NULL DEFAULT '2030-01-01' AFTER post; Query OK, 12394 rows affected (1.24 sec) Records: 12394 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE order1 ADD paytime DATE NOT NULL DEFAULT '2030-01-01' AFTER p osttime; Query OK, 12394 rows affected (0.89 sec) Records: 12394 Duplicates: 0 Warnings: 0 mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | char(100) | NO | | NO | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2030-01-01 | | | paytime | date | NO | | 2030-01-01 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2030-00-00 | | | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | | paymemo | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 30 rows in set (0.31 sec) mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | char(100) | NO | | NO | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2030-00-00 | | | paytime | date | NO | | 2030-00-00 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2030-00-00 | | | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | | paymemo | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 30 rows in set (0.00 sec) 假设现在的ORDER都已到货! mysql> UPDATE enq2 SET arrivaltime = '2010-01-01'; Query OK, 13944 rows affected (0.44 sec) Rows matched: 13944 Changed: 13944 Warnings: 0 mysql> show columns from enq2; +-------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | 2011-00-00 | | | enq1id | int(11) | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | makerid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | type1id | text | YES | | NULL | | | partsid | text | YES | | NULL | | | QTY | text | YES | | NULL | | | memo | text | YES | | NULL | | | price | text | YES | | NULL | | | discount | text | YES | | NULL | | | discount0 | int(11) | YES | | NULL | | | money | int(11) | YES | | NULL | | | price1 | text | YES | | NULL | | | makerref | text | YES | | NULL | | | disc | text | YES | | NULL | | | charges | text | YES | | NULL | | | status | int(11) | NO | | 0 | | | post | char(100) | NO | | NO | | | arrivaltime | date | NO | | 2030-01-01 | | | arrivalmemo | text | YES | | NULL | | +-------------+-----------+------+-----+------------+----------------+ 25 rows in set (0.00 sec) mysql> ALTER TABLE enq2 ADD arrivaltime DATE NOT NULL DEFAULT '2030-01-01'; Query OK, 13944 rows affected (2.05 sec) Records: 13944 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE enq2 ADD arrivalmemo TEXT; Query OK, 13944 rows affected (1.17 sec) Records: 13944 Duplicates: 0 Warnings: 0 mysql> show columns from enq2; +------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | 2011-00-00 | | | enq1id | int(11) | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | makerid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | type1id | text | YES | | NULL | | | partsid | text | YES | | NULL | | | QTY | text | YES | | NULL | | | memo | text | YES | | NULL | | | price | text | YES | | NULL | | | discount | text | YES | | NULL | | | discount0 | int(11) | YES | | NULL | | | money | int(11) | YES | | NULL | | | price1 | text | YES | | NULL | | | makerref | text | YES | | NULL | | | disc | text | YES | | NULL | | | charges | text | YES | | NULL | | | status | int(11) | NO | | 0 | | | post | char(100) | NO | | NO | | +------------+-----------+------+-----+------------+----------------+ 23 rows in set (0.41 sec) <tr bgcolor="lightcyan" align="center"><td>入荷確認</td><td> <!-- post --> <form action="" method="post"> <input type=text size=50 name="content" value="<TMPL_VAR NAME="post">"> <input type="submit" value="入力"> <input type="hidden" name="pat" value="r_header"> <input type="hidden" name="table" value="enq2"> <input type="hidden" name="item" value="post"> <input type="hidden" name="id" value=<TMPL_VAR NAME="enq2_id">> <input type="hidden" name="rm" value="modeqtn_input"> </form> </td></tr> mysql> show columns from makers; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | name1 | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(200) | YES | | NULL | | | nationid | int(11) | NO | | 2 | | +----------+-----------+------+-----+---------+----------------+ 10 rows in set (0.02 sec) mysql> ALTER TABLE makers ADD name1 CHAR(100) AFTER company; Query OK, 771 rows affected (1.42 sec) Records: 771 Duplicates: 0 Warnings: 0 mysql> UPDATE makers SET name1 = company; Query OK, 771 rows affected (0.30 sec) Rows matched: 771 Changed: 771 Warnings: 0 mysql> show columns from makers; +----------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | company | char(100) | YES | | NULL | | | address | char(100) | YES | | NULL | | | person | char(50) | YES | | NULL | | | telfax | char(100) | YES | | NULL | | | email | char(100) | YES | | NULL | | | homepage | char(100) | YES | | NULL | | | memo | char(200) | YES | | NULL | | | nationid | int(11) | NO | | 2 | | +----------+-----------+------+-----+---------+----------------+ 9 rows in set (0.59 sec)
mysql> SELECT makers.company FROM makers,enq2 WHERE enq2.makerid=makers.id AND enq2.id = 2021; mysql> UPDATE order1 SET posttime = '2010-01-01'; Query OK, 12388 rows affected (0.73 sec) Rows matched: 12388 Changed: 12388 Warnings: 0 mysql> UPDATE order1 SET paytime = '2010-01-01'; Query OK, 12388 rows affected (0.38 sec) Rows matched: 12388 Changed: 12388 Warnings: 0 mysql> UPDATE order1 SET arrivaltime = '2010-01-01'; Query OK, 12388 rows affected (1.03 sec) Rows matched: 12388 Changed: 12388 Warnings: 0 mysql> SELECT enq1.owner,order1.id,order1.orderno FROM order1,enq1 WHERE order1. id=enq1.id AND enq1.owner = 1 LIMIT 5; +-------+----+---------+ | owner | id | orderno | +-------+----+---------+ | 1 | 1 | NO | | 1 | 2 | NO | | 1 | 9 | NO | | 1 | 10 | NO | | 1 | 12 | NO | +-------+----+---------+ 5 rows in set (0.00 sec) mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | char(100) | NO | | NO | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2030-01-01 | | | paytime | date | NO | | 2030-01-01 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2030-01-01 | | | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 29 rows in set (0.53 sec) mysql> ALTER TABLE order1 ALTER posttime SET DEFAULT '2030-01-01'; Query OK, 0 rows affected (0.48 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE order1 ALTER paytime SET DEFAULT '2030-01-01'; Query OK, 0 rows affected (0.08 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> ALTER TABLE order1 ALTER arrivaltime SET DEFAULT '2030-01-01'; Query OK, 0 rows affected (0.11 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> show columns from order1; +-----------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | orderno | char(100) | NO | | NO | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | memo | text | YES | | NULL | | | consignee | text | YES | | NULL | | | changeprice | text | YES | | NULL | | | discount | text | YES | | NULL | | | total | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | packing_charge | text | YES | | NULL | | | freight_charges | text | YES | | NULL | | | delivery_charge | text | YES | | NULL | | | delivery_place | text | YES | | NULL | | | disc | text | YES | | NULL | | | shipping | text | YES | | NULL | | | packing | text | YES | | NULL | | | packing_info | text | YES | | NULL | | | post | char(100) | NO | | NO | | | posttime | date | NO | | 2011-00-00 | | | paytime | date | NO | | 0000-00-00 | | | status | int(11) | NO | | 0 | | | arrivaltime | date | NO | | 2011-00-00 | |=>入庫状況,最新的入庫时间,注意如果是分批入庫,旧的时间写在下面的memo | arrivalmemo | text | YES | | NULL | | | size | text | YES | | NULL | | | weight | text | YES | | NULL | | +-----------------+-----------+------+-----+------------+----------------+ 29 rows in set (0.39 sec) mysql> show columns from enq1; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | NULL | | | ourref | char(11) | YES | | NULL | | | owner | int(11) | YES | | NULL | | | ownerno | varchar(100) | YES | | NULL | | | hullnoid | int(11) | YES | | NULL | | | type1id | text | YES | | NULL | | | partsid | text | YES | | NULL | | | QTY | text | YES | | NULL | | | memo | text | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | makerid | int(11) | YES | | NULL | | | enq2s | text | YES | | NULL | | | seriesid | text | YES | | NULL | | | tmp_pname | text | YES | | NULL | | | tmp_pcode | text | YES | | NULL | | | tmp_pqty | text | YES | | NULL | | +------------+--------------+------+-----+---------+----------------+ 17 rows in set (0.16 sec) mysql> show columns from enq2; +------------+-----------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-----------+------+-----+------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | time | date | YES | | 2011-00-00 | | | enq1id | int(11) | YES | | NULL | | | LANGUAGEid | int(11) | YES | | NULL | | | ORIGINid | int(11) | YES | | NULL | | | PRICEid | int(11) | YES | | NULL | | | PAYMENTid | int(11) | YES | | NULL | | | makerid | int(11) | YES | | NULL | | | DELIVERY | text | YES | | NULL | | | type1id | text | YES | | NULL | | | partsid | text | YES | | NULL | | | QTY | text | YES | | NULL | | | memo | text | YES | | NULL | | | price | text | YES | | NULL | | | discount | text | YES | | NULL | | | discount0 | int(11) | YES | | NULL | | | money | int(11) | YES | | NULL | | | price1 | text | YES | | NULL | | | makerref | text | YES | | NULL | | | disc | text | YES | | NULL | | | charges | text | YES | | NULL | | | status | int(11) | NO | | 0 | | | post | char(100) | NO | | NO | | +------------+-----------+------+-----+------------+----------------+ 23 rows in set (0.97 sec)
返回