多表联接和 with 组合使用生成 SQL 错误
作者: Marber-seven创建于 2021年1月12日更新于 2021年1月12日
- 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 INTOfa_test_order_goodsVALUES (1, 1, 'test11', 1); INSERT INTOfa_test_order_goodsVALUES (2, 1, 'test11', 1); INSERT INTOfa_test_order_goodsVALUES (3, 1, 'test11', 1); INSERT INTOfa_test_order_goodsVALUES (4, 1, 'test11', 1); - 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 INTOfa_test_order_groupVALUES (1, 1, 1610434018); INSERT INTOfa_test_order_groupVALUES (2, 1, 1610434062); INSERT INTOfa_test_order_groupVALUES (3, 1, 1610434073); INSERT INTOfa_test_order_groupVALUES (4, 1, 1610434684); - 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 INTOfa_test_order_logVALUES (4, 'test title1', 'test content11');
内容来源: easy-swoole/orm