Have you ever wondered how to update the status of an order to
"Closed" when the whole ordered quantity has been received?
If you are on a database that supports triggers like me (I'm on
MySQL 5.0.16 right now) you can have something like:
Table structure:
Orders table
- DROP TABLE IF EXISTS `test`.`orders`;
- CREATE TABLE `test`.`orders` (
- `order_id` int( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT,
- `order_date` datetime DEFAULT NULL,
- `order_status` CHAR ( 1 ) NOT NULL DEFAULT '',
- PRIMARY KEY ( `order_id` )
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Order lines table
- DROP TABLE IF EXISTS `test`.`order_lines`;
- CREATE TABLE `test`.`order_lines` (
- `order_id` int( 10 ) UNSIGNED NOT NULL DEFAULT '0', …