#201·orm

多表联接和 with 组合使用生成 SQL 错误

作者: Marber-seven创建于 2021年1月12日更新于 2021年1月12日
  1. Database 1 CREATE TABLE fa_test_order_goods ( order_id int(11) NOT NULL COMMENT 'order id', goods_id int(11) NOT NULL COMMENT 'goods id', name varchar(255) NOT NULL DEFAULT '' COMMENT 'goods name', num int(11) DEFAULT NULL COMMENT 'quantity' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; INSERT INTO fa_test_order_goods VALUES (1, 1, 'test11', 1); INSERT INTO fa_test_order_goods VALUES (2, 1, 'test11', 1); INSERT INTO fa_test_order_goods VALUES (3, 1, 'test11', 1); INSERT INTO fa_test_order_goods VALUES (4, 1, 'test11', 1);
  2. Database 2 CREATE TABLE fa_test_order_group ( order_id int(11) NOT NULL COMMENT 'order id', is_join tinyint(1) NOT NULL COMMENT 'is joined? 1: yes, 0: no', join_time int(11) NOT NULL COMMENT 'join time' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; INSERT INTO fa_test_order_group VALUES (1, 1, 1610434018); INSERT INTO fa_test_order_group VALUES (2, 1, 1610434062); INSERT INTO fa_test_order_group VALUES (3, 1, 1610434073); INSERT INTO fa_test_order_group VALUES (4, 1, 1610434684);
  3. Database 3 CREATE TABLE fa_test_order_log ( order_id int(11) NOT NULL COMMENT 'order id', title varchar(255) NOT NULL COMMENT 'title', content varchar(255) NOT NULL COMMENT 'content' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; INSERT INTO fa_test_order_log VALUES (4, 'test title1', 'test content11');

内容来源: easy-swoole/orm