Not found: Table sql-practice-361723:warehouse_orders.orders was not found in location US -- GOOGLE Analytics

Viewed 21

Of note. When I remove the from section and run it in a separate query the code works. I can Inner Join, Outer Join, Left Join or Right Join. However, when I add the code back to the case query it returns the error message not found in location US.

Thanks, M

SECTION OF CODE IN QUESTION

FROM `sql-practice-361723.warehouse_orders.Warehouse` AS warehouse
LEFT JOIN    
`sql-practice-361723.warehouse_orders.Orders`As Orders    
ON
warehouse.warehouse_id = Orders.warehouse_id

--> FULL CODE

SELECT
Warehouse.warehouse_id,
CONCAT(Warehouse.state, ':' , Warehouse.warehouse_alias) AS warehouse_name,
COUNT(Orders.order_id) AS num_of_orders,
(SELECT
COUNT(*)
FROM warehouse_orders.orders As orders) AS total_orders,
CASE
WHEN COUNT(orders.orders_id/(SELECT COUNT (*) FROM warehouse_orders.orders AS Orders)) <= 0.2
then "Fullfilled 0%-20% of Orders"
WHEN COUNT(orders.orders_id/(SELECT COUNT (*) FROM warehouse_orders.orders AS Orders)) > 
0.2
and COUNT(orders.orders_id/(SELECT COUNT (*) FROM warehouse_orders.orders AS Orders)) <= 
0.6
then "Fullfilled 21%-60% of Orders"
ELSE "Fullfilled more than 60% of Orders"
END AS fullfillment_summary 
FROM `sql-practice-361723.warehouse_orders.Warehouse` AS warehouse
LEFT JOIN
`sql-practice-361723.warehouse_orders.Orders`As Orders
ON
warehouse.warehouse_id = Orders.warehouse_id
GROUP BY
Warehouse.warehouse_id,
warehouse_name
HAVING
COUNT(Orders.order_id > 0)
1 Answers

I went through and adjusted the code slightly. I adjusted the aliases to reflect to full location parameters of the data table in the Case portion of the code.

Also there was an error in the HAVINVG Count code. the () were incorrectly placed.

No idea why the alias did nor work as planned but the work around was simple to put the direct location into the CASE code and it solved my issue.

Of note although I thought the problem was in the FROM LEFT Join section the problem appeared earlier in the code where the table was already to be populated.

Any additional comments greatly appreciated, M

Related