Это моя скрипка :
CREATE TABLE order_match(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
quantity decimal(10,2), createdAt date NOT NULL, order_status_id int(10) NOT NULL,
createdby int(11), code_order varchar(20) NOT NULL);
CREATE TABLE air_way_bills (id int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
code_order varchar(30) NOT NULL PRIMARY KEY, customer_regency varchar(30) NOT NULL);
, и я сделал этот запрос
SELECT COALESCE(customer_regency, 'Total') AS `Kabupaten/Kota`,
SUM(quantity) AS `Qty(kg)`,
round(SUM(quantity) / any_value(totalsum) * 100, 1) AS `Qty(%)`,
COUNT(order_match.id) AS `Jumlah Order`,
round(COUNT(order_match.id) / any_value(totalcount) * 100, 1) AS `Jumlah Order(%)`
FROM order_match a
/* 1 */ INNER JOIN air_way_bills b
/* 1 */ ON a.code_order = b.code_order
/* 2 */ INNER JOIN ( SELECT s1.createdby
FROM order_match s1
WHERE s1.order_status_Id in (4, 5, 6, 8)
GROUP BY s1.createdby
HAVING SUM(s1.createdAt BETWEEN '2020-02-01' AND '2020-02-28')
AND SUM(s1.createdAt <= '2020-02-28') = 1 ) clients
/* 2 */ ON order_match.createdby = clients.createdby
JOIN ( SELECT SUM(quantity) totalsum,
COUNT(order_buyer_id) totalcount
FROM order_match
/* 3 */ INNER JOIN ( SELECT s2.createdby
FROM order_match s2
WHERE s2.order_status_id in (4, 5, 6, 8)
GROUP BY s2.createdby
HAVING SUM(s2.createdAt BETWEEN '2020-02-01' AND '2020-02-28')
AND SUM(s2.createdAt <= '2020-02-28') = 1 ) clients
/* 3 */ ON order_match.createdby = clients.createdby
WHERE order_status_Id in (4, 5, 6, 8)) totals
WHERE order_match.order_status_Id in (4, 5, 6, 8)
GROUP BY customer_regency WITH ROLLUP;
, но вместо этого появляется результат, скрипка приходит с этим уведомлением
Table 'db_712942043.air_way_bills' doesn't exist
понятия не имею, что делать